Skip to content
Closed
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
15 changes: 15 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,21 @@ to redefine the ``event_loop`` fixture to have the same or broader scope.
Async fixtures need the event loop, and so must have the same or narrower scope
than the ``event_loop`` fixture.

Python 3.5 lacks support for async generators. If you really need support for
Python 3.5, you can still mimic a tear down using pytest's finalizers. Notice
that the event loop is not running inside finalizers:

.. code-block:: python

@pytest.fixture
async def async_fixture(request, event_loop):
def fin():
async def afin():
await some_teardown()
event_loop.run_until_complete(afin())
request.addfinalizer(fin)
return 'a value'

Markers
-------

Expand Down