mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-31 21:39:41 +08:00
fix: compatibility with different path separators of Linux and Windows
This commit is contained in:
@@ -2,7 +2,7 @@ import os
|
||||
import unittest
|
||||
|
||||
from httprunner import compat, exceptions, loader
|
||||
from httprunner.compat import convert_variables
|
||||
from httprunner.compat import convert_variables, ensure_path_sep
|
||||
|
||||
|
||||
class TestCompat(unittest.TestCase):
|
||||
@@ -213,3 +213,19 @@ class TestCompat(unittest.TestCase):
|
||||
"--self-contained-html",
|
||||
],
|
||||
)
|
||||
|
||||
def test_ensure_file_path(self):
|
||||
self.assertEqual(
|
||||
ensure_path_sep("demo\\test.yml"), os.sep.join(["demo", "test.yml"])
|
||||
)
|
||||
self.assertEqual(
|
||||
ensure_path_sep(os.path.join(os.getcwd(), "demo\\test.yml")),
|
||||
os.path.join(os.getcwd(), os.sep.join(["demo", "test.yml"])),
|
||||
)
|
||||
self.assertEqual(
|
||||
ensure_path_sep("demo/test.yml"), os.sep.join(["demo", "test.yml"])
|
||||
)
|
||||
self.assertEqual(
|
||||
ensure_path_sep(os.path.join(os.getcwd(), "demo/test.yml")),
|
||||
os.path.join(os.getcwd(), os.sep.join(["demo", "test.yml"])),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user