Skip to content

no-conftest-test-module-import

Do not import individual test modules from conftest.py.

Why

pytest imports conftest for every test module in its scope; importing a specific test from conftest turns that test into global collection infrastructure and creates cycles and order dependence.

Fix

Move shared fixtures or helpers into conftest.py or a dedicated support module.

Examples

Before — flagged Conftest imports a specific test module
tests/conftest.py
from tests.test_api import make_client
After — preferred Conftest imports dedicated support code
tests/conftest.py
from tests.helpers import make_client