Skip to content

Consider entry points for PYTEST_PLUGINS and pytest_plugins #12624

Open
@mtelka

Description

@mtelka

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: configrelated to config handling, argument parsing and config filetopic: reportingrelated to terminal output and user-facing messages and errors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions