1212
1313import  _pytest ._code 
1414from  _pytest  import  nodes 
15+ from  _pytest .config  import  Config 
1516from  _pytest .config  import  directory_arg 
1617from  _pytest .config  import  hookimpl 
1718from  _pytest .config  import  UsageError 
@@ -339,18 +340,6 @@ def pytest_collection_modifyitems(items, config):
339340        items [:] =  remaining 
340341
341342
342- class  FSHookProxy :
343-     def  __init__ (self , fspath , pm , remove_mods ):
344-         self .fspath  =  fspath 
345-         self .pm  =  pm 
346-         self .remove_mods  =  remove_mods 
347- 
348-     def  __getattr__ (self , name ):
349-         x  =  self .pm .subset_hook_caller (name , remove_plugins = self .remove_mods )
350-         self .__dict__ [name ] =  x 
351-         return  x 
352- 
353- 
354343class  NoMatch (Exception ):
355344    """ raised if matching cannot locate a matching names. """ 
356345
@@ -381,7 +370,7 @@ class Session(nodes.FSCollector):
381370    _setupstate  =  None   # type: SetupState 
382371    _fixturemanager  =  None   # type: FixtureManager 
383372
384-     def  __init__ (self , config ) :
373+     def  __init__ (self , config :  Config )  ->   None :
385374        nodes .FSCollector .__init__ (
386375            self , config .rootdir , parent = None , config = config , session = self , nodeid = "" 
387376        )
@@ -390,16 +379,15 @@ def __init__(self, config):
390379        self .shouldstop  =  False 
391380        self .shouldfail  =  False 
392381        self .trace  =  config .trace .root .get ("collection" )
393-         self ._norecursepatterns  =  config .getini ("norecursedirs" )
394382        self .startdir  =  config .invocation_dir 
395-         self ._initialpaths  =  frozenset ()
383+         self ._initialpaths  =  frozenset ()   # type: ignore 
396384        # Keep track of any collected nodes in here, so we don't duplicate fixtures 
397-         self ._node_cache  =  {}
385+         self ._node_cache  =  {}   # type: ignore 
398386        self ._bestrelpathcache  =  _bestrelpath_cache (
399387            config .rootdir 
400388        )  # type: Dict[str, str] 
401389        # Dirnames of pkgs with dunder-init files. 
402-         self ._pkg_roots  =  {}
390+         self ._pkg_roots  =  {}   # type: ignore 
403391
404392        self .config .pluginmanager .register (self , name = "session" )
405393
@@ -440,20 +428,6 @@ def pytest_runtest_logreport(self, report):
440428    def  isinitpath (self , path ):
441429        return  path  in  self ._initialpaths 
442430
443-     def  gethookproxy (self , fspath ):
444-         # check if we have the common case of running 
445-         # hooks with all conftest.py files 
446-         pm  =  self .config .pluginmanager 
447-         my_conftestmodules  =  pm ._getconftestmodules (fspath )
448-         remove_mods  =  pm ._conftest_plugins .difference (my_conftestmodules )
449-         if  remove_mods :
450-             # one or more conftests are not in use at this fspath 
451-             proxy  =  FSHookProxy (fspath , pm , remove_mods )
452-         else :
453-             # all plugins are active for this fspath 
454-             proxy  =  self .config .hook 
455-         return  proxy 
456- 
457431    def  perform_collect (self , args = None , genitems = True ):
458432        hook  =  self .config .hook 
459433        try :
@@ -616,19 +590,6 @@ def _collectfile(self, path, handle_dupes=True):
616590
617591        return  ihook .pytest_collect_file (path = path , parent = self )
618592
619-     def  _recurse (self , dirpath : py .path .local ) ->  bool :
620-         if  dirpath .basename  ==  "__pycache__" :
621-             return  False 
622-         ihook  =  self .gethookproxy (dirpath .dirpath ())
623-         if  ihook .pytest_ignore_collect (path = dirpath , config = self .config ):
624-             return  False 
625-         for  pat  in  self ._norecursepatterns :
626-             if  dirpath .check (fnmatch = pat ):
627-                 return  False 
628-         ihook  =  self .gethookproxy (dirpath )
629-         ihook .pytest_collect_directory (path = dirpath , parent = self )
630-         return  True 
631- 
632593    @staticmethod  
633594    def  _visit_filter (f ):
634595        return  f .check (file = 1 )
0 commit comments