fix: compatibility with different path separators of Linux and Windows

This commit is contained in:
debugtalk
2020-06-14 22:01:09 +08:00
parent a05d590f73
commit f4aa0b9913
4 changed files with 33 additions and 1 deletions

View File

@@ -348,3 +348,15 @@ def session_fixture(request):
f.write(conftest_content)
logger.info("generated conftest.py to generate summary.json")
def ensure_path_sep(path: Text) -> Text:
""" ensure compatibility with different path separators of Linux and Windows
"""
if "/" in path:
path = os.sep.join(path.split("/"))
if "\\" in path:
path = os.sep.join(path.split("\\"))
return path