Replies: 2 comments
-
Hi,
I assume you mean test modules and test classes right? Otherwise your question does not make sense to me, because pytest runs tests, not packages/classes. If you do mean test modules/classes, one way would be to use import somepackage_test
@pytest.fixture(scope='session', autouse=True)
def some_mock(request):
if request.module is not somepackage_test:
return
with mock.patch('somepackage.somemethod') as _fixture:
yield _fixture Same logic for |
Beta Was this translation helpful? Give feedback.
-
An alternative is to remove pytestmark = pytest.mark.usefixtures("your_fixture_name") this saves you adding |
Beta Was this translation helpful? Give feedback.
-
Hi.
Suppose we have such fixture in conftest.py globally.
But we want it to run with scope session, but for specific classes or modules.
Without creating dirs, or writing it in specific py file, can we say it somehow to run only in specified places?
For example
Beta Was this translation helpful? Give feedback.
All reactions