Skip to content

Replace yield_fixture() by fixture() #138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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