How to use pytest.yield_fixture and why it be deprecated?
#14435
Replies: 2 comments
-
|
sorry |
Beta Was this translation helpful? Give feedback.
-
|
@aiwonderland — It still works — but you should migrate. Why it was deprecated: before pytest 3.0, What to use: import pytest
@pytest.fixture
def db_connection():
conn = create_connection() # setup
yield conn # the test runs here
conn.close() # teardownThis is identical to what References:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
How to use
pytest.yield_fixtureand why it be deprecated?I see https://docs.pytest.org/en/stable/yieldfixture.html
Remember to tag me!
Beta Was this translation helpful? Give feedback.
All reactions