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(
558
558
entries = sorted (os .scandir (path ), key = lambda entry : entry .name )
559
559
yield from entries
560
560
for entry in entries :
561
- if entry .is_dir (follow_symlinks = False ) and recurse (entry ):
561
+ if entry .is_dir () and recurse (entry ):
562
562
yield from visit (entry .path , recurse )
563
563
564
564
Original file line number Diff line number Diff line change 9
9
from _pytest .main import _in_venv
10
10
from _pytest .main import Session
11
11
from _pytest .pathlib import symlink_or_skip
12
+ from _pytest .pytester import Pytester
12
13
from _pytest .pytester import Testdir
13
14
14
15
@@ -1178,6 +1179,15 @@ def test_nodeid(request):
1178
1179
assert result .ret == 0
1179
1180
1180
1181
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
+
1181
1191
def test_collectignore_via_conftest (testdir ):
1182
1192
"""collect_ignore in parent conftest skips importing child (issue #4592)."""
1183
1193
tests = testdir .mkpydir ("tests" )
You can’t perform that action at this time.
0 commit comments