Replies: 2 comments 1 reply
|
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 _fixtureSame logic for |
0 replies
|
An alternative is to remove pytestmark = pytest.mark.usefixtures("your_fixture_name")this saves you adding |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
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
All reactions