Skip to content

Commit 4fd295e

Browse files
committed
Use native path separator on Windows
1 parent cf72387 commit 4fd295e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/functional/test_install.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2641,13 +2641,20 @@ def add_link(tar: tarfile.TarFile, name: str, linktype: str, target: str) -> Non
26412641
add_file(sdist_tar, "src/linktest/sub/__init__.py", "")
26422642
add_file(sdist_tar, "src/linktest/sub/inner.dat", "Data")
26432643
linknames = []
2644+
2645+
# Windows requires native path separators in symlink targets.
2646+
# (see https://github.com/python/cpython/issues/57911)
2647+
# (This is not needed for hardlinks, nor for the workaround tarfile
2648+
# uses if symlinking is disabled.)
2649+
SEP = os.path.sep
2650+
26442651
pkg_root = f"{common_prefix}src/linktest"
26452652
for prefix, target_tag, linktype, target in [
26462653
("", "root", "sym", "root.dat"),
26472654
("", "root", "hard", f"{pkg_root}/root.dat"),
2648-
("", "inner", "sym", "sub/inner.dat"),
2655+
("", "inner", "sym", f"sub{SEP}inner.dat"),
26492656
("", "inner", "hard", f"{pkg_root}/sub/inner.dat"),
2650-
("sub/", "root", "sym", "../root.dat"),
2657+
("sub/", "root", "sym", f"..{SEP}root.dat"),
26512658
("sub/", "root", "hard", f"{pkg_root}/root.dat"),
26522659
("sub/", "inner", "sym", "inner.dat"),
26532660
("sub/", "inner", "hard", f"{pkg_root}/sub/inner.dat"),

0 commit comments

Comments
 (0)