fix: unittests on Windows

This commit is contained in:
debugtalk
2020-06-17 22:09:51 +08:00
parent 72193806ae
commit 11c7d30f9f
3 changed files with 85 additions and 25 deletions

View File

@@ -107,20 +107,26 @@ class TestUtils(unittest.TestCase):
def test_ensure_file_path_valid(self):
self.assertEqual(
ensure_file_path_valid("examples/a-b.c/d f/hardcode.yml"),
os.path.join(os.getcwd(), "examples/a_b_c/d_f/hardcode.yml"),
ensure_file_path_valid(
os.path.join("examples", "a-b.c", "d f", "hardcode.yml")
),
os.path.join(os.getcwd(), "examples", "a_b_c", "d_f", "hardcode.yml"),
)
self.assertEqual(
ensure_file_path_valid("1/2B/3.yml"),
os.path.join(os.getcwd(), "T1/T2B/T3.yml"),
ensure_file_path_valid(os.path.join("1", "2B", "3.yml")),
os.path.join(os.getcwd(), "T1", "T2B", "T3.yml"),
)
self.assertEqual(
ensure_file_path_valid("examples/a-b.c/2B/hardcode.yml"),
os.path.join(os.getcwd(), "examples/a_b_c/T2B/hardcode.yml"),
ensure_file_path_valid(
os.path.join("examples", "a-b.c", "2B", "hardcode.yml")
),
os.path.join(os.getcwd(), "examples", "a_b_c", "T2B", "hardcode.yml"),
)
self.assertEqual(
ensure_file_path_valid("examples/postman_echo/request_methods/"),
os.path.join(os.getcwd(), "examples/postman_echo/request_methods"),
ensure_file_path_valid(
os.path.join("examples", "postman_echo", "request_methods")
),
os.path.join(os.getcwd(), "examples", "postman_echo", "request_methods"),
)
self.assertEqual(
ensure_file_path_valid(os.path.join(os.getcwd(), "test.yml")),