Skip to content

Commit

Permalink
fix: Expect backslashes on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
r-leyshon committed Sep 19, 2023
1 parent 0420bae commit 1214d20
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/utils/test_defence.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,8 @@ class Test_HandlePathLike(object):
)
def test__handle_path_like_with_strings(self, param_nm, path, expected):
"""For all keys in pth_str, test the path against the expected path."""
if os.name == "nt":
expected = expected.replace("/", "\\")
pth = _handle_path_like(path, param_nm).__str__()
assert pth.endswith(expected), f"Expected: {expected}, Found: {pth}"

Expand All @@ -405,6 +407,9 @@ def test__handle_path_like_with_strings(self, param_nm, path, expected):
)
def test__handle_path_like_with_posix_pths(self, param_nm, path, expected):
"""For all keys in posix_pth, test path against expected."""
# when all is said and done, on Windows you'll get backward slashes
if os.name == "nt":
expected = expected.replace("/", "\\")
pth = _handle_path_like(path, param_nm).__str__()
assert pth.endswith(expected), f"Expected: {expected}, Found: {pth}"

Expand Down

0 comments on commit 1214d20

Please sign in to comment.