Skip to content

Commit

Permalink
Consider entry_points for PYTEST_PLUGINS and pytest_plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
mtelka committed Jul 16, 2024
1 parent 400b22d commit 82619a9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ Mandeep Bhutani
Manuel Krebber
Marc Mueller
Marc Schlaich
Marcel Telka
Marcelo Duarte Trevisani
Marcin Bachry
Marc Bresson
Expand Down
5 changes: 5 additions & 0 deletions changelog/12615.bugfix.rst
Original file line number Diff line number Diff line change
@@ -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 <pip-installable plugins>` names additionally to the
importable definitions. Prior to this release, these identifiers used to only
work with the `-p` CLI option.
2 changes: 1 addition & 1 deletion doc/en/reference/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/_pytest/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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``.
Expand Down

0 comments on commit 82619a9

Please sign in to comment.