File tree Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 1+ Fixed symlinked directories not being followed during collection. Regressed in pytest 6.1.0.
Original file line number Diff line number Diff line change @@ -558,7 +558,7 @@ def visit(
558558 entries = sorted (os .scandir (path ), key = lambda entry : entry .name )
559559 yield from entries
560560 for entry in entries :
561- if entry .is_dir (follow_symlinks = False ) and recurse (entry ):
561+ if entry .is_dir () and recurse (entry ):
562562 yield from visit (entry .path , recurse )
563563
564564
Original file line number Diff line number Diff line change 99from _pytest .main import _in_venv
1010from _pytest .main import Session
1111from _pytest .pathlib import symlink_or_skip
12+ from _pytest .pytester import Pytester
1213from _pytest .pytester import Testdir
1314
1415
@@ -1178,6 +1179,15 @@ def test_nodeid(request):
11781179 assert result .ret == 0
11791180
11801181
1182+ def test_collect_symlink_dir (pytester : Pytester ) -> None :
1183+ """A symlinked directory is collected."""
1184+ dir = pytester .mkdir ("dir" )
1185+ dir .joinpath ("test_it.py" ).write_text ("def test_it(): pass" , "utf-8" )
1186+ pytester .path .joinpath ("symlink_dir" ).symlink_to (dir )
1187+ result = pytester .runpytest ()
1188+ result .assert_outcomes (passed = 2 )
1189+
1190+
11811191def test_collectignore_via_conftest (testdir ):
11821192 """collect_ignore in parent conftest skips importing child (issue #4592)."""
11831193 tests = testdir .mkpydir ("tests" )
You can’t perform that action at this time.
0 commit comments