diff --git a/AUTHORS b/AUTHORS index 8d31170560c..1b8d48e9ff7 100644 --- a/AUTHORS +++ b/AUTHORS @@ -257,6 +257,7 @@ Mandeep Bhutani Manuel Krebber Marc Mueller Marc Schlaich +Marcel Telka Marcelo Duarte Trevisani Marcin Bachry Marc Bresson diff --git a/changelog/12615.bugfix.rst b/changelog/12615.bugfix.rst new file mode 100644 index 00000000000..7ef0ea5e7ee --- /dev/null +++ b/changelog/12615.bugfix.rst @@ -0,0 +1,5 @@ +Plugins specified in the :globalvar:`pytest_plugins` config setting and +:envvar:`PYTEST_PLUGINS` environment variable now allow using +:ref:`entry points ` names additionally to the +importable definitions. Prior to this release, these identifiers used to only +work with the `-p` CLI option. diff --git a/doc/en/reference/reference.rst b/doc/en/reference/reference.rst index d1222728e13..4911f16aa92 100644 --- a/doc/en/reference/reference.rst +++ b/doc/en/reference/reference.rst @@ -1153,7 +1153,7 @@ specified plugins will be loaded. .. envvar:: PYTEST_PLUGINS -Contains comma-separated list of modules that should be loaded as plugins: +Contains comma-separated list of modules or entry points that should be loaded as plugins: .. code-block:: bash diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index 0c1850df503..bb8cf4b0ad9 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -828,7 +828,7 @@ def _import_plugin_specs( ) -> None: plugins = _get_plugin_specs_as_list(spec) for import_spec in plugins: - self.import_plugin(import_spec) + self.import_plugin(import_spec, consider_entry_points=True) def import_plugin(self, modname: str, consider_entry_points: bool = False) -> None: """Import a plugin with ``modname``.