Skip to content

Commit 0958182

Browse files
committed
Add extra layer of backslash escaping to match test stderr on Windows
1 parent 004f144 commit 0958182

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests/functional/test_install_script.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,17 @@ def test_script_file_python_version(script: PipTestEnvironment) -> None:
9191
expect_stderr=True,
9292
expect_error=True,
9393
)
94+
95+
if sys.platform == "win32":
96+
# Special case: result.stderr contains an extra layer of backslash
97+
# escaping, transform our path to match
98+
script_path_str = str(script_path).replace("\\", "\\\\")
99+
else:
100+
script_path_str = str(script_path)
101+
94102
assert (
95-
f"ERROR: Script '{script_path}' requires a different Python" in result.stderr
103+
f"ERROR: Script '{script_path_str}' requires a different Python"
104+
in result.stderr
96105
), (
97106
"Script with incompatible requires-python did not fail as expected -- "
98107
+ result.stderr

0 commit comments

Comments
 (0)