Reputation: 621
Lets say I have a fixture like this:
@pytest.fixture(scope="class")
def some_fixture(some_paramaters):
do_something
yield
do_something
And i want to use it in this way:
@pytest.mark.usefixtures('some_fixtures')
class TestSomething:
code....
Is it possible to pass the parameter some_paramter using @pytest.mark.usefixtures decorator. Or is there any way to pass that parameter?
Upvotes: 0
Views: 294
Reputation: 514
You could use something like this by using an autouse fixture.
import pytest
import requests
@pytest.fixture(scope="class")
def some_fixture(some_parameters):
do_something
yield
do_something
class TestSomething:
@pytest.fixture(autouse=True)
def _calling_method(self, some_fixture):
self._response = some_fixture(some_parameters)
Upvotes: 1