Use this tag for questions about pytest fixtures (built-in or defined using the @pytest.fixture decorator).
Questions tagged [pytest-fixtures]
36 questions
0
votes
1 answer
ScopeMismatch when i try to make setup_teardown pytest function
My goal is to create a fixture that will run once at the beginning of the class function test and initialize the attributes I need in self. To do this, I created a fixture with the scope of the class and applied it directly to the class. To solve…

mdar
- 1
- 2
0
votes
1 answer
pytest caplog LogCaptureFixture is broken when using logging.config.dictConfig()
I have been going around in circles on this problem for several days now and I am no closer to a solution than when I started.
I have reviewed all of the other stackoverflow entries dealing with the pytest caplog fixture and I have narrowed my…

Mark B Sawyer
- 3
- 2
0
votes
0 answers
PyCharm incorrect code completion when using identical named fixtures across modules
I've just started using pytest with PyCharm (version 2022.1.4) and am stumped on a pytest fixture / PyCharm code completion issue.
In this example, I have two modules a.py and b.py which are part of the same project. There is a fixture in a.py and…

trb
- 120
- 2
- 12
0
votes
2 answers
Using function scoped fixture to setup a class
I have a fixture in conftest.py with a function scope.
@pytest.fixture()
def registration_setup(
test_data, # fixture 1
credentials, # fixture 2
deployment # fixture 3
deployment_object # fixture 4
):
# pre-test cleanup
…

pankaj_m05
- 7
- 4
0
votes
1 answer
In-memory dynamodb for tests that run in parallel
I am using python 3.9 and in my project I have bunch of integration tests that runs with in-memory dynamo-db using moto 4.0.7. My configuration setup looks like this -
@pytest.fixture(scope="session", name="dynamodb_server")
def…

a13e
- 838
- 2
- 11
- 27
0
votes
1 answer
pytest not able to find fixture
#@pytest.fixture()
def create_list():
test_strings = ["Walker", "Rio"]
return test_strings
def test_supplier(create_list):
global driver
chrome_linux_64 = './Drivers/chromedriver_linux64'
driver =…

varun
- 201
- 1
- 5
- 13