Skip to content

Commit 607abba

Browse files
committed
Fix tests with PyPy on Windows
1 parent 1a492aa commit 607abba

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

tests/test_paths_stdlib.py

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import pytest
2525

2626
# this package
27+
from domdf_python_tools.compat import PYPY
2728
from domdf_python_tools.paths import PathPlus, PosixPathPlus, WindowsPathPlus
2829

2930
try:
@@ -86,13 +87,14 @@ def dirlink(src, dest):
8687
f.write(b"this is file D\n")
8788
os.chmod(join("dirE"), 0)
8889

89-
# Relative symlinks.
90-
os.symlink("fileA", join("linkA"))
91-
os.symlink("non-existing", join("brokenLink"))
92-
dirlink("dirB", join("linkB"))
93-
dirlink(os.path.join("..", "dirB"), join("dirA", "linkC"))
94-
# This one goes upwards, creating a loop.
95-
dirlink(os.path.join("..", "dirB"), join("dirB", "linkD"))
90+
if not PYPY and sys.platform != "win32":
91+
# Relative symlinks.
92+
os.symlink("fileA", join("linkA"))
93+
os.symlink("non-existing", join("brokenLink"))
94+
dirlink("dirB", join("linkB"))
95+
dirlink(os.path.join("..", "dirB"), join("dirA", "linkC"))
96+
# This one goes upwards, creating a loop.
97+
dirlink(os.path.join("..", "dirB"), join("dirB", "linkD"))
9698

9799
yield tmp_pathplus
98100

@@ -485,9 +487,10 @@ def test_is_dir(BASE):
485487
assert not ((P / "non-existing").is_dir())
486488
assert not ((P / "fileA" / "bah").is_dir())
487489

488-
assert not ((P / "linkA").is_dir())
489-
assert ((P / "linkB").is_dir())
490-
assert not (P / "brokenLink").is_dir()
490+
if not PYPY and sys.platform != "win32":
491+
assert not ((P / "linkA").is_dir())
492+
assert ((P / "linkB").is_dir())
493+
assert not (P / "brokenLink").is_dir()
491494

492495

493496
def test_is_file(BASE):
@@ -497,9 +500,10 @@ def test_is_file(BASE):
497500
assert not ((P / "non-existing").is_file())
498501
assert not ((P / "fileA" / "bah").is_file())
499502

500-
assert ((P / "linkA").is_file())
501-
assert not ((P / "linkB").is_file())
502-
assert not ((P / "brokenLink").is_file())
503+
if not PYPY and sys.platform != "win32":
504+
assert ((P / "linkA").is_file())
505+
assert not ((P / "linkB").is_file())
506+
assert not ((P / "brokenLink").is_file())
503507

504508

505509
@only_posix
@@ -522,9 +526,10 @@ def test_is_symlink(BASE):
522526
assert not ((P / "non-existing").is_symlink())
523527
assert not ((P / "fileA" / "bah").is_symlink())
524528

525-
assert ((P / "linkA").is_symlink())
526-
assert ((P / "linkB").is_symlink())
527-
assert ((P / "brokenLink").is_symlink())
529+
if not PYPY and sys.platform != "win32":
530+
assert ((P / "linkA").is_symlink())
531+
assert ((P / "linkB").is_symlink())
532+
assert ((P / "brokenLink").is_symlink())
528533

529534

530535
def test_is_fifo_false(BASE):

0 commit comments

Comments
 (0)