-
Notifications
You must be signed in to change notification settings - Fork 237
Open
Labels
agent-pythoncommunityIssues opened by the communityIssues opened by the communitytriageIssues awaiting triageIssues awaiting triage
Description
Currently, conftest.py resides in the project root, next to the tests/ directory.
This causes pytest fixture discovery to fail in isolated build environments
(e.g., CI, pybuild, or other minimal test setups), because pytest only
automatically loads conftest.py files from directories containing test
files or their parent directories that are part of the test tree.
Key points:
- pytest treats conftest.py specially: it is automatically discovered and
should not be imported manually. Relative or absolute imports of
conftest.py from test files are not allowed. - In isolated builds, the tests are executed from the test tree
(e.g., .pybuild/.../build/tests/), so a conftest.py in the root is
outside pytest’s discovery path, leading to fixture errors like:
fixture 'elasticapm_client' not found - Moving conftest.py into tests/ ensures that all fixtures
(elasticapm_client, waiting_httpserver, etc.) are correctly discovered
by pytest in all environments (local, CI, pbuilder, etc.) - This change is fully compliant with pytest best practices, upstream-friendly,
and does not modify any fixture logic.
After this change:
- Tests work correctly in isolated environments.
- No need for sys.path hacks or imports from conftest.py.
- pytest fixture discovery behaves as intended both locally and in CI.
Metadata
Metadata
Assignees
Labels
agent-pythoncommunityIssues opened by the communityIssues opened by the communitytriageIssues awaiting triageIssues awaiting triage