File tree Expand file tree Collapse file tree 3 files changed +11
-19
lines changed Expand file tree Collapse file tree 3 files changed +11
-19
lines changed Original file line number Diff line number Diff line change @@ -281,15 +281,6 @@ def pytest_ignore_collect(path, config):
281281 if _in_venv (path ) and not allow_in_venv :
282282 return True
283283
284- # Skip duplicate paths.
285- keepduplicates = config .getoption ("keepduplicates" )
286- duplicate_paths = config .pluginmanager ._duplicatepaths
287- if not keepduplicates :
288- if path in duplicate_paths :
289- return True
290- else :
291- duplicate_paths .add (path )
292-
293284 return False
294285
295286
@@ -559,6 +550,16 @@ def _collectfile(self, path):
559550 if not self .isinitpath (path ):
560551 if ihook .pytest_ignore_collect (path = path , config = self .config ):
561552 return ()
553+
554+ # Skip duplicate paths.
555+ keepduplicates = self .config .getoption ("keepduplicates" )
556+ if not keepduplicates :
557+ duplicate_paths = self .config .pluginmanager ._duplicatepaths
558+ if path in duplicate_paths :
559+ return ()
560+ else :
561+ duplicate_paths .add (path )
562+
562563 return ihook .pytest_collect_file (path = path , parent = self )
563564
564565 def _recurse (self , path ):
Original file line number Diff line number Diff line change @@ -552,15 +552,6 @@ def isinitpath(self, path):
552552 return path in self .session ._initialpaths
553553
554554 def collect (self ):
555- # XXX: HACK!
556- # Before starting to collect any files from this package we need
557- # to cleanup the duplicate paths added by the session's collect().
558- # Proper fix is to not track these as duplicates in the first place.
559- for path in list (self .session .config .pluginmanager ._duplicatepaths ):
560- # if path.parts()[:len(self.fspath.dirpath().parts())] == self.fspath.dirpath().parts():
561- if path .dirname .startswith (self .name ):
562- self .session .config .pluginmanager ._duplicatepaths .remove (path )
563-
564555 this_path = self .fspath .dirpath ()
565556 init_module = this_path .join ("__init__.py" )
566557 if init_module .check (file = 1 ) and path_matches_patterns (
Original file line number Diff line number Diff line change @@ -219,7 +219,7 @@ class TestY(TestX):
219219 started = reprec .getcalls ("pytest_collectstart" )
220220 finished = reprec .getreports ("pytest_collectreport" )
221221 assert len (started ) == len (finished )
222- assert len (started ) == 7 # XXX extra TopCollector
222+ assert len (started ) == 8
223223 colfail = [x for x in finished if x .failed ]
224224 assert len (colfail ) == 1
225225
You can’t perform that action at this time.
0 commit comments