mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-12 16:01:27 +08:00
fix: unittest for jsonschema checker
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
HttpRunner loader
|
HttpRunner loader
|
||||||
|
|
||||||
- check: validate testcase data structure with JSON schema (TODO)
|
- check: validate api/testcase/testsuite data structure with JSON schema
|
||||||
- locate: locate debugtalk.py, make it's dir as project root path
|
- locate: locate debugtalk.py, make it's dir as project root path
|
||||||
- load: load testcase files and relevant data, including debugtalk.py, .env, yaml/json api/testcases, csv, etc.
|
- load: load testcase files and relevant data, including debugtalk.py, .env, yaml/json api/testcases, csv, etc.
|
||||||
- buildup: assemble loaded content to httprunner testcase/testsuite data structure
|
- buildup: assemble loaded content to httprunner testcase/testsuite data structure
|
||||||
|
|||||||
@@ -188,8 +188,6 @@ def is_testcase_path(path):
|
|||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# TODO: check file format if valid
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import unittest
|
|||||||
|
|
||||||
from httprunner import exceptions
|
from httprunner import exceptions
|
||||||
from httprunner.loader import load
|
from httprunner.loader import load
|
||||||
|
from httprunner.loader.buildup import load_test_file
|
||||||
|
|
||||||
|
|
||||||
class TestFileLoader(unittest.TestCase):
|
class TestFileLoader(unittest.TestCase):
|
||||||
@@ -14,7 +15,7 @@ class TestFileLoader(unittest.TestCase):
|
|||||||
f.write("")
|
f.write("")
|
||||||
|
|
||||||
with self.assertRaises(exceptions.FileFormatError):
|
with self.assertRaises(exceptions.FileFormatError):
|
||||||
load._load_yaml_file(yaml_tmp_file)
|
load_test_file(yaml_tmp_file)
|
||||||
|
|
||||||
os.remove(yaml_tmp_file)
|
os.remove(yaml_tmp_file)
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ class TestFileLoader(unittest.TestCase):
|
|||||||
f.write("abc")
|
f.write("abc")
|
||||||
|
|
||||||
with self.assertRaises(exceptions.FileFormatError):
|
with self.assertRaises(exceptions.FileFormatError):
|
||||||
load._load_yaml_file(yaml_tmp_file)
|
load_test_file(yaml_tmp_file)
|
||||||
|
|
||||||
os.remove(yaml_tmp_file)
|
os.remove(yaml_tmp_file)
|
||||||
|
|
||||||
@@ -34,7 +35,7 @@ class TestFileLoader(unittest.TestCase):
|
|||||||
f.write("")
|
f.write("")
|
||||||
|
|
||||||
with self.assertRaises(exceptions.FileFormatError):
|
with self.assertRaises(exceptions.FileFormatError):
|
||||||
load._load_json_file(json_tmp_file)
|
load_test_file(json_tmp_file)
|
||||||
|
|
||||||
os.remove(json_tmp_file)
|
os.remove(json_tmp_file)
|
||||||
|
|
||||||
@@ -43,7 +44,7 @@ class TestFileLoader(unittest.TestCase):
|
|||||||
f.write("{}")
|
f.write("{}")
|
||||||
|
|
||||||
with self.assertRaises(exceptions.FileFormatError):
|
with self.assertRaises(exceptions.FileFormatError):
|
||||||
load._load_json_file(json_tmp_file)
|
load_test_file(json_tmp_file)
|
||||||
|
|
||||||
os.remove(json_tmp_file)
|
os.remove(json_tmp_file)
|
||||||
|
|
||||||
@@ -52,7 +53,7 @@ class TestFileLoader(unittest.TestCase):
|
|||||||
f.write("abc")
|
f.write("abc")
|
||||||
|
|
||||||
with self.assertRaises(exceptions.FileFormatError):
|
with self.assertRaises(exceptions.FileFormatError):
|
||||||
load._load_json_file(json_tmp_file)
|
load_test_file(json_tmp_file)
|
||||||
|
|
||||||
os.remove(json_tmp_file)
|
os.remove(json_tmp_file)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user