I've got several test classes that are using the same fixtures, with the exception that on some classes I need the fixtures to be in class scope while in other Classes the scope should be per test function.
How can I select the fixture scope according to test class name or some other input parameter ?
here's a pseudo-code illustration :
#if class=='classA'
@pytest.fixture(scope='class')
#else
@pytest.fixture(scope='function')
#endif
def myfix(request):
#fixture implementation
Aucun commentaire:
Enregistrer un commentaire