File tree Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -423,9 +423,12 @@ def _collect(self, arg):
423
423
else :
424
424
assert argpath .check (file = 1 )
425
425
pkginit = argpath .dirpath ().join ('__init__.py' )
426
- if not self .isinitpath (argpath ) and pkginit .exists ():
426
+ if not self .isinitpath (pkginit ):
427
+ self ._initialpaths .add (pkginit )
428
+ if pkginit .exists ():
427
429
for x in self ._collectfile (pkginit ):
428
- yield x
430
+ for y in self .matchnodes (x ._collectfile (argpath ), names ):
431
+ yield y
429
432
else :
430
433
for x in self .matchnodes (self ._collectfile (argpath ), names ):
431
434
yield x
Original file line number Diff line number Diff line change @@ -927,7 +927,7 @@ def pytest_runtest_teardown(item):
927
927
928
928
929
929
def test_modulecol_roundtrip (testdir ):
930
- modcol = testdir .getmodulecol ("pass" , withinit = True )
930
+ modcol = testdir .getmodulecol ("pass" , withinit = False )
931
931
trail = modcol .nodeid
932
932
newcol = modcol .session .perform_collect ([trail ], genitems = 0 )[0 ]
933
933
assert modcol .name == newcol .name
Original file line number Diff line number Diff line change @@ -587,7 +587,7 @@ def test_pkgfile(self, testdir):
587
587
col = testdir .getnode (config , x )
588
588
assert isinstance (col , pytest .Module )
589
589
assert col .name == 'x.py'
590
- assert col .parent .parent is None
590
+ assert col .parent .parent . parent is None
591
591
for col in col .listchain ():
592
592
assert col .config is config
593
593
You can’t perform that action at this time.
0 commit comments