Skip to content

If I can't put pytest_plugins in my conftest.py, where do I put it? #4039

@njsmith

Description

@njsmith

In pytest-trio, we include the tests inside the package, in a pytest_trio/_tests/ subpackage.

(I know this is controversial in various ways, but according to the docs it is an officially supported configuration.)

Since pytest-trio is itself a pytest plugin, it wants to use the pytester plugin in its test suite. So, at the top of our test suite in pytest_trio/_tests/conftest.py, we have:

pytest_plugins = ["pytester"]

Recently, pytest has started issuing a warning here:

/home/njs/pytest-trio/pytest_trio/_tests/conftest.py:0: RemovedInPytest4Warning: Defining pytest_plugins in a non-top-level conftest is deprecated, because it affects the entire directory tree in a non-explicit way.
Please move it to the top level conftest file instead.

But... this file is already at the top of my test suite. Where am I supposed to put it instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: configrelated to config handling, argument parsing and config filetype: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions