summaryrefslogtreecommitdiff
path: root/setuptools/tests/test_editable_install.py
diff options
context:
space:
mode:
authorAnderson Bravalheri <andersonbravalheri@gmail.com>2022-08-04 08:53:01 +0100
committerAnderson Bravalheri <andersonbravalheri@gmail.com>2022-08-04 08:53:01 +0100
commit4c2611b46e62db85a771ea27d59abdb25967c1fe (patch)
treef3321cecd76e79ffd75bf802b7442166b907f70e /setuptools/tests/test_editable_install.py
parentf3e11d70952ea5a9c0241e4ebfaaf40222900fb5 (diff)
downloadpython-setuptools-git-4c2611b46e62db85a771ea27d59abdb25967c1fe.tar.gz
Prevent test errors on Windows due to path sep
Diffstat (limited to 'setuptools/tests/test_editable_install.py')
-rw-r--r--setuptools/tests/test_editable_install.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/setuptools/tests/test_editable_install.py b/setuptools/tests/test_editable_install.py
index 1f23a46a..57e31eda 100644
--- a/setuptools/tests/test_editable_install.py
+++ b/setuptools/tests/test_editable_install.py
@@ -662,17 +662,17 @@ def test_compat_install(tmp_path, venv):
out = venv.run(["python", "-c", "import mypkg.mod1; print(mypkg.mod1.var)"])
assert b"42" in out
- expected_path = str(tmp_path).lower().replace(os.sep, "/")
+ expected_path = comparable_path(str(tmp_path))
- # Compatible behaviour will make spurious modules and excluded files importable
+ # Compatible behaviour will make spurious modules and excluded
+ # files importable directly from the original path
for cmd in (
"import otherfile; print(otherfile)",
"import other; print(other)",
"import mypkg; print(mypkg)",
):
- out = str(venv.run(["python", "-c", cmd]), "utf-8").lower().replace(os.sep, "/")
+ out = comparable_path(str(venv.run(["python", "-c", cmd]), "utf-8"))
assert expected_path in out
- # Compatible mode works by adding the project dir to sys.path
# Compatible behaviour will not consider custom mappings
cmd = """\
@@ -713,3 +713,7 @@ def assert_link_to(file: Path, other: Path):
other_stat = other.stat()
assert file_stat[stat.ST_INO] == other_stat[stat.ST_INO]
assert file_stat[stat.ST_DEV] == other_stat[stat.ST_DEV]
+
+
+def comparable_path(str_with_path: str) -> str:
+ return str_with_path.lower().replace(os.sep, "/").replace("//", "/")