Skip to content

Commit 0dc81ac

Browse files
Mulat MekonenMulat Mekonen
authored andcommitted
Skip symlink sibling test on Windows without symlink support
1 parent b1e100d commit 0dc81ac

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

testing/test_collection.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,6 +1860,21 @@ def test_pyargs_collection_tree(pytester: Pytester, monkeypatch: MonkeyPatch) ->
18601860
)
18611861

18621862

1863+
def _can_create_symlink(tmp_path: Path) -> bool:
1864+
target = tmp_path / "target"
1865+
target.mkdir()
1866+
link = tmp_path / "link"
1867+
try:
1868+
os.symlink(target, link, target_is_directory=True)
1869+
return link.is_symlink()
1870+
except (OSError, NotImplementedError):
1871+
return False
1872+
1873+
1874+
@pytest.mark.skipif(
1875+
sys.platform.startswith("win") and not _can_create_symlink(Path.cwd()),
1876+
reason="Windows without symlink support",
1877+
)
18631878
def test_do_not_collect_symlink_siblings(
18641879
pytester: Pytester, tmp_path: Path, request: pytest.FixtureRequest
18651880
) -> None:

0 commit comments

Comments
 (0)