MCPcopy
hub / github.com/pytest-dev/pytest / register

Method register

src/_pytest/config/__init__.py:560–583  ·  src/_pytest/config/__init__.py::PytestPluginManager.register
(self, plugin: _PluggyPlugin, name: str | None = None)

Source from the content-addressed store, hash-verified

558 return opts
559
560 def register(self, plugin: _PluggyPlugin, name: str | None = None) -> str | None:
561 if name in _pytest.deprecated.DEPRECATED_EXTERNAL_PLUGINS:
562 warnings.warn(
563 PytestConfigWarning(
564 class="st">"{} plugin has been merged into the core, "
565 class="st">"please remove it from your requirements.".format(
566 name.replace(class="st">"_", class="st">"-")
567 )
568 )
569 )
570 return None
571 plugin_name = super().register(plugin, name)
572 if plugin_name is not None:
573 self.hook.pytest_plugin_registered.call_historic(
574 kwargs=dict(
575 plugin=plugin,
576 plugin_name=plugin_name,
577 manager=self,
578 )
579 )
580
581 if isinstance(plugin, types.ModuleType):
582 self.consider_module(plugin)
583 return plugin_name
584
585 def getplugin(self, name: str):
586 class="cm"># 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