fix: unittests on Windows

This commit is contained in:
debugtalk
2020-06-17 22:09:51 +08:00
parent 429276c43b
commit 74dab0e8ec
3 changed files with 85 additions and 25 deletions

View File

@@ -14,7 +14,7 @@ class TestLoader(unittest.TestCase):
self.assertEqual(len(testcase_obj.teststeps), 3)
def test_load_json_file_file_format_error(self):
json_tmp_file = "/tmp/tmp.json"
json_tmp_file = "tmp.json"
# create empty file
with open(json_tmp_file, "w") as f:
f.write("")
@@ -111,7 +111,7 @@ class TestLoader(unittest.TestCase):
start_path = os.path.join(os.getcwd(), "examples", "httpbin")
self.assertEqual(
loader.locate_file(start_path, "debugtalk.py"),
os.path.join(os.getcwd(), "examples/httpbin/debugtalk.py"),
os.path.join(os.getcwd(), "examples", "httpbin", "debugtalk.py"),
)
self.assertEqual(
loader.locate_file("examples/httpbin/", "debugtalk.py"),
@@ -119,5 +119,5 @@ class TestLoader(unittest.TestCase):
)
self.assertEqual(
loader.locate_file("examples/httpbin/", "debugtalk.py"),
os.path.join(os.getcwd(), "examples/httpbin/debugtalk.py"),
os.path.join(os.getcwd(), "examples", "httpbin", "debugtalk.py"),
)