Skip to content

Commit

Permalink
Replace yield_fixture() by fixture()
Browse files Browse the repository at this point in the history
@pytest.yeld_fixture is deprecated since pytest-3.0, see:
https://docs.pytest.org/en/latest/yieldfixture.html
  • Loading branch information
atugushev authored and Tinche committed Mar 29, 2020
1 parent 964b295 commit 21a0f94
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.rst
Expand Up @@ -81,7 +81,7 @@ event loop. This will take effect even if you're using the

.. code-block:: python
@pytest.yield_fixture()
@pytest.fixture
def event_loop():
loop = MyCustomLoop()
yield loop
Expand Down
2 changes: 1 addition & 1 deletion pytest_asyncio/plugin.py
Expand Up @@ -166,7 +166,7 @@ def pytest_runtest_setup(item):
)


@pytest.yield_fixture
@pytest.fixture
def event_loop(request):
"""Create an instance of the default event loop for each test case."""
loop = asyncio.get_event_loop_policy().new_event_loop()
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Expand Up @@ -9,7 +9,7 @@
collect_ignore.append("async_fixtures/test_nested_36.py")


@pytest.yield_fixture()
@pytest.fixture
def dependent_fixture(event_loop):
"""A fixture dependent on the event_loop fixture, doing some cleanup."""
counter = 0
Expand Down
2 changes: 1 addition & 1 deletion tests/multiloop/conftest.py
Expand Up @@ -8,7 +8,7 @@ class CustomSelectorLoop(asyncio.SelectorEventLoop):
pass


@pytest.yield_fixture()
@pytest.fixture
def event_loop():
"""Create an instance of the default event loop for each test case."""
loop = CustomSelectorLoop()
Expand Down

0 comments on commit 21a0f94

Please sign in to comment.