Skip to content

Add package scoped fixtures #2283

Closed
Closed
@mosoto

Description

@mosoto

Session level scoping is great for expensive setup steps but it doesn't cleanup until the end of the test run. If you are testing multiple packages with conflicting setups you are forced to invoke py.test multiple times, once per package. We would love to have package scoped fixtures - run setup/teardown once per package.

e.g.
With directory structure:

/package1/conftest.py
/package1/test_package1.py
/package2/conftest.py
/package2/test_package2.py

a package scoped fixture defined in /package1/conftest.py would run setup before running the tests in the package1 directory and teardown immediately after finishing the tests in the package1 directory, before running tests in the package2 directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: backward compatibilitymight present some backward compatibility issues which should be carefully noted in the changelogtype: enhancementnew feature or API change, should be merged into features branchtype: feature-branchnew feature or API change, should be merged into features branchtype: 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