Skip to content
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

Open
mtelka opened this issue Jul 16, 2024 · 0 comments · May be fixed by #12616
Open

Consider entry points for PYTEST_PLUGINS and pytest_plugins #12624

mtelka opened this issue Jul 16, 2024 · 0 comments · May be fixed by #12616
Labels
topic: config related to config handling, argument parsing and config file topic: reporting related to terminal output and user-facing messages and errors

Comments

@mtelka
Copy link

mtelka commented Jul 16, 2024

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 the self.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 to runpytest() 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

mtelka added a commit to mtelka/pytest that referenced this issue Jul 16, 2024
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.
mtelka added a commit to mtelka/pytest that referenced this issue Jul 16, 2024
… 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.
mtelka added a commit to mtelka/pytest that referenced this issue Jul 16, 2024
… 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.
@Zac-HD Zac-HD added topic: reporting related to terminal output and user-facing messages and errors topic: config related to config handling, argument parsing and config file labels Jul 21, 2024
mtelka added a commit to mtelka/pytest that referenced this issue Jul 22, 2024
… 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: config related to config handling, argument parsing and config file topic: reporting related to terminal output and user-facing messages and errors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants