MCPcopy Create free account
hub / github.com/pytest-dev/pytest / register

Method register

src/_pytest/config/__init__.py:447–468  ·  view source on GitHub ↗
(
        self, plugin: _PluggyPlugin, name: Optional[str] = None
    )

Source from the content-addressed store, hash-verified

445 return opts
446
447 def register(
448 self, plugin: _PluggyPlugin, name: Optional[str] = None
449 ) -> Optional[str]:
450 if name in _pytest.deprecated.DEPRECATED_EXTERNAL_PLUGINS:
451 warnings.warn(
452 PytestConfigWarning(
453 "{} plugin has been merged into the core, "
454 "please remove it from your requirements.".format(
455 name.replace("_", "-")
456 )
457 )
458 )
459 return None
460 ret: Optional[str] = super().register(plugin, name)
461 if ret:
462 self.hook.pytest_plugin_registered.call_historic(
463 kwargs=dict(plugin=plugin, manager=self)
464 )
465
466 if isinstance(plugin, types.ModuleType):
467 self.consider_module(plugin)
468 return ret
469
470 def getplugin(self, name: str):
471 # Support deprecated naming because plugins (xdist e.g.) use it.

Callers 15

__init__Method · 0.95
consider_conftestMethod · 0.95
import_pluginMethod · 0.95
pytest_configureFunction · 0.80
pytest_configureFunction · 0.80
pytest_configureFunction · 0.80
__init__Method · 0.80
pytest_configureFunction · 0.80
pytest_configureFunction · 0.80

Calls 4

consider_moduleMethod · 0.95
PytestConfigWarningClass · 0.90
warnMethod · 0.45
formatMethod · 0.45