-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Open
Labels
topic: fixturesanything involving fixtures directly or indirectlyanything involving fixtures directly or indirectlytype: proposalproposal for a new feature, often to gather opinions or design the API around the new featureproposal for a new feature, often to gather opinions or design the API around the new feature
Description
pytest version 5.2.2
Tried to use dynamic scopes for fixtures. However, the scope definition is executed only once - during the fixture definition.
We would like to have option to control fixture scope during test run.
This will allow code re-use in tests which need the code in different scope.
For example: set up a docker - one test needs it in function level and a separate test needs it in module level.
@pytest.fixture()
def some_fixture():
pass
# test_method.py
@pytest.mark.scope('some_fixture', 'module')
def test_method(some_fixture):
pass
# test_function.py
@pytest.mark.scope('some_fixture', 'function')
def test_method(some_fixture):
pass
sh-at-cs
Metadata
Metadata
Assignees
Labels
topic: fixturesanything involving fixtures directly or indirectlyanything involving fixtures directly or indirectlytype: proposalproposal for a new feature, often to gather opinions or design the API around the new featureproposal for a new feature, often to gather opinions or design the API around the new feature