simplify by removing the single-call "exclude_pytest_names" function
This commit is contained in:
		
							parent
							
								
									03aca9ea79
								
							
						
					
					
						commit
						971ebcbd77
					
				| 
						 | 
					@ -120,12 +120,6 @@ def _prepareconfig(args=None, plugins=None):
 | 
				
			||||||
        raise
 | 
					        raise
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def exclude_pytest_names(name):
 | 
					 | 
				
			||||||
    return not name.startswith(name) or name == "pytest_plugins" or \
 | 
					 | 
				
			||||||
           name.startswith("pytest_funcarg__")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class PytestPluginManager(PluginManager):
 | 
					class PytestPluginManager(PluginManager):
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    Overwrites :py:class:`pluggy.PluginManager` to add pytest-specific
 | 
					    Overwrites :py:class:`pluggy.PluginManager` to add pytest-specific
 | 
				
			||||||
| 
						 | 
					@ -171,14 +165,14 @@ class PytestPluginManager(PluginManager):
 | 
				
			||||||
        return self.add_hookspecs(module_or_class)
 | 
					        return self.add_hookspecs(module_or_class)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def parse_hookimpl_opts(self, plugin, name):
 | 
					    def parse_hookimpl_opts(self, plugin, name):
 | 
				
			||||||
        if exclude_pytest_names(name):
 | 
					 | 
				
			||||||
            return None
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # pytest hooks are always prefixed with pytest_
 | 
					        # pytest hooks are always prefixed with pytest_
 | 
				
			||||||
        # so we avoid accessing possibly non-readable attributes
 | 
					        # so we avoid accessing possibly non-readable attributes
 | 
				
			||||||
        # (see issue #1073)
 | 
					        # (see issue #1073)
 | 
				
			||||||
        if not name.startswith("pytest_"):
 | 
					        if not name.startswith("pytest_"):
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
 | 
					        # ignore some historic special names which can not be hooks anyway
 | 
				
			||||||
 | 
					        if name == "pytest_plugins" or name.startswith("pytest_funcarg__"):
 | 
				
			||||||
 | 
					            return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        method = getattr(plugin, name)
 | 
					        method = getattr(plugin, name)
 | 
				
			||||||
        opts = super(PytestPluginManager, self).parse_hookimpl_opts(plugin, name)
 | 
					        opts = super(PytestPluginManager, self).parse_hookimpl_opts(plugin, name)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue