-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider entry points for PYTEST_PLUGINS
and pytest_plugins
#12624
Comments
This allows to load plugins via `PYTEST_PLUGINS` environment variable and `pytest_plugins` global variable using their names in `entry_points.txt` files. Closes pytest-dev#12624.
… var This allows to load plugins via `PYTEST_PLUGINS` environment variable and `pytest_plugins` global variable using their names in `entry_points.txt` files. Closes pytest-dev#12624.
… var This allows to load plugins via `PYTEST_PLUGINS` environment variable and `pytest_plugins` global variable using their names in installed package entry points. Closes pytest-dev#12624.
… var This allows to load plugins via `PYTEST_PLUGINS` environment variable and `pytest_plugins` global variable using their names in installed package entry points. Closes pytest-dev#12624.
… var This allows to load plugins via `PYTEST_PLUGINS` environment variable and `pytest_plugins` global variable using their names in installed package entry points. Closes pytest-dev#12624.
Was trying to get reproducible pytest runs, so I didn't want to rely on automatic loading and instead wanted to explicitly tell which modules should be loaded. It turned out to be a huge pain to figure out needed module names to specify like
For example flake - "flake" didn't work, "pytest_flake" also didn't etc. With patch from this issue things work nicely and no need to guess module names. Simple PYTEST_PLUGINS=flake worked. Thanks. |
…like: PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 PYTEST_PLUGINS=xyz,abc; see pytest-dev/pytest#12624
What's the problem this feature will solve?
Currently it is not possible to load plugins via
PYTEST_PLUGINS
/pytest_plugins
using their entry points. Only module names are recognized.Describe the solution you'd like
The simple add of
consider_entry_points=True
to theself.import_plugin()
call in the_import_plugin_specs()
allows to load plugins using their entry points.See also #12615 (comment)
Alternative Solutions
It is possible to use different ways to load plugins (like
-p
option), but alternatives have other drawbacks. For example list of plugins loaded using-p
is not passed down torunpytest()
calls.It is also possible to use module names in
PYTEST_PLUGINS
/pytest_plugins
, but this would need to use not so well known plugin names and it also does have a problem that plugins loaded this way are not listed in the test report (bug #12615).Additional context
N/A
The text was updated successfully, but these errors were encountered: