Skip to content

Commit b421d7f

Browse files
Mulat MekonenMulat Mekonen
authored andcommitted
Skip symlink sibling test on Windows without symlink support #13771
1 parent b1e100d commit b421d7f

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ Mike Hoyle (hoylemd)
320320
Mike Lundy
321321
Milan Lesnek
322322
Miro Hrončok
323+
Mulat Mekonen
323324
mrbean-bremen
324325
Nathan Goldbaum
325326
Nathan Rousseau

changelog/12039.contrib.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Skip `test_do_not_collect_symlink_siblings` on Windows environments without symlink support to avoid false negatives.

changelog/13771.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Skip `test_do_not_collect_symlink_siblings` on Windows environments without symlink support to avoid false negatives.

testing/test_collection.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1864,14 +1864,16 @@ def test_do_not_collect_symlink_siblings(
18641864
pytester: Pytester, tmp_path: Path, request: pytest.FixtureRequest
18651865
) -> None:
18661866
"""
1867-
Regression test for #12039: Do not collect from directories that are symlinks to other directories in the same path.
1867+
Regression test for #12039: Do not collect from directories that are symlinks
1868+
to other directories in the same path.
18681869
1869-
The check for short paths under Windows via os.path.samefile, introduced in #11936, also finds the symlinked
1870-
directory created by tmp_path/tmpdir.
1870+
On Windows without Developer Mode or admin rights, symlink creation may fail.
1871+
In that case we skip this test to avoid false negatives.
18711872
"""
18721873
# Use tmp_path because it creates a symlink with the name "current" next to the directory it creates.
18731874
symlink_path = tmp_path.parent / (tmp_path.name[:-1] + "current")
1874-
assert symlink_path.is_symlink() is True
1875+
if not symlink_path.is_symlink():
1876+
pytest.skip("Symlinks not supported in this environment")
18751877

18761878
# Create test file.
18771879
tmp_path.joinpath("test_foo.py").write_text("def test(): pass", encoding="UTF-8")

0 commit comments

Comments
 (0)