Skip to content

pytest_configure is ignored in conftest.py when using xdist #917

@ericpre

Description

@ericpre

When running the test suite with pytest --pyargs package -n 2, the content of the pytest_configure hook in conftest.py doesn't run:

def pytest_configure(config):
    # Run in pytest_configure hook to avoid capturing stdout by pytest and
    # inform user that the test data are being downloaded

    # Workaround to avoid running it for each worker
    worker_id = os.environ.get("PYTEST_XDIST_WORKER")
    if worker_id is None:
        print("Checking if test data need downloading...")
        download_all()
        print("All test data available.")

While it works fine when running pytest -n 2 from the tests folder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions