easyStudy question · answer published in Automation Testing interview questions, so no pointspytestfixtures
What a pytest fixture does
What is the main purpose of a pytest fixture such as the one below?
@pytest.fixture
def api_client():
client = ApiClient(base_url=BASE_URL)
yield client
client.close()Discussion 0
Join free to post in the discussion.
Related questions
- Sharing fixtures in pytestAutomation Test Engineer
- Asserting that an error is raisedAutomation Test Engineer
- Running pytest in parallelAutomation Test Engineer
- A custom Playwright fixtureAutomation Test Engineer
- Counting parametrized testsAutomation Test Engineer
- Clean-up in a pytest fixtureAutomation Test Engineer
- An expected failure that starts passingAutomation Test Engineer
- Worker-scoped fixturesAutomation Test Engineer