Skip to content

support conftest/ folders #13108

Open
Open
@ofer-pd

Description

@ofer-pd

What's the problem this feature will solve?

I'm tired of putting so much code in a single tests/conftest.py file.

Describe the solution you'd like

It'd be nice if I could expand conftest.py into a folder, like this:

tests/conftest/__init__.py    # loaded instead of conftest.py; imports from sibling modules
tests/conftest/fixtures.py
tests/conftest/setup.py

Alternative Solutions

I could create a different folder, like tests/lib/, add code there, and import that code from tests/conftest.py, but I'd prefer to keep the rest of the tests/ namespace free. For example, the way I organize my tests is identical to how I organize my code. If I have a source file lib/foo.py, I'll create tests for it in tests/lib/test__foo.py. If I used tests/lib/ to instead store setup code for the test suite, that would conflict with the above convention.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: fixturesanything involving fixtures directly or indirectlytype: proposalproposal for a new feature, often to gather opinions or design the API around the new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions