File tree Expand file tree Collapse file tree 2 files changed +10
-18
lines changed Expand file tree Collapse file tree 2 files changed +10
-18
lines changed Original file line number Diff line number Diff line change @@ -278,15 +278,6 @@ def pytest_ignore_collect(path, config):
278
278
if _in_venv (path ) and not allow_in_venv :
279
279
return True
280
280
281
- # Skip duplicate paths.
282
- keepduplicates = config .getoption ("keepduplicates" )
283
- duplicate_paths = config .pluginmanager ._duplicatepaths
284
- if not keepduplicates :
285
- if path in duplicate_paths :
286
- return True
287
- else :
288
- duplicate_paths .add (path )
289
-
290
281
return False
291
282
292
283
@@ -556,6 +547,16 @@ def _collectfile(self, path):
556
547
if not self .isinitpath (path ):
557
548
if ihook .pytest_ignore_collect (path = path , config = self .config ):
558
549
return ()
550
+
551
+ # Skip duplicate paths.
552
+ keepduplicates = self .config .getoption ("keepduplicates" )
553
+ if not keepduplicates :
554
+ duplicate_paths = self .config .pluginmanager ._duplicatepaths
555
+ if path in duplicate_paths :
556
+ return ()
557
+ else :
558
+ duplicate_paths .add (path )
559
+
559
560
return ihook .pytest_collect_file (path = path , parent = self )
560
561
561
562
def _recurse (self , path ):
Original file line number Diff line number Diff line change @@ -554,15 +554,6 @@ def isinitpath(self, path):
554
554
return path in self .session ._initialpaths
555
555
556
556
def collect (self ):
557
- # XXX: HACK!
558
- # Before starting to collect any files from this package we need
559
- # to cleanup the duplicate paths added by the session's collect().
560
- # Proper fix is to not track these as duplicates in the first place.
561
- for path in list (self .session .config .pluginmanager ._duplicatepaths ):
562
- # if path.parts()[:len(self.fspath.dirpath().parts())] == self.fspath.dirpath().parts():
563
- if path .dirname .startswith (self .name ):
564
- self .session .config .pluginmanager ._duplicatepaths .remove (path )
565
-
566
557
this_path = self .fspath .dirpath ()
567
558
init_module = this_path .join ("__init__.py" )
568
559
if init_module .check (file = 1 ) and path_matches_patterns (
You can’t perform that action at this time.
0 commit comments