Skip to content

Commit 2fd10f8

Browse files
committed
docs: Clarify deprecation of event_loop fixture.
1 parent a4e82ab commit 2fd10f8

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

docs/reference/fixtures/index.rst

+9
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ Fixtures
44

55
event_loop
66
==========
7+
*This fixture is deprecated.*
8+
9+
*If you want to request an asyncio event loop with a scope other than function
10+
scope, use the "loop_scope" argument to* :ref:`reference/markers/asyncio` *when marking the tests.
11+
If you want to return different types of event loops, use the* :ref:`reference/fixtures/event_loop_policy`
12+
*fixture.*
13+
714
Creates a new asyncio event loop based on the current event loop policy. The new loop
815
is available as the return value of this fixture for synchronous functions, or via `asyncio.get_running_loop <https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.get_running_loop>`__ for asynchronous functions.
916
The event loop is closed when the fixture scope ends.
@@ -20,6 +27,8 @@ If you need to change the type of the event loop, prefer setting a custom event
2027
If the ``pytest.mark.asyncio`` decorator is applied to a test function, the ``event_loop``
2128
fixture will be requested automatically by the test function.
2229

30+
.. _reference/fixtures/event_loop_policy:
31+
2332
event_loop_policy
2433
=================
2534
Returns the event loop policy used to create asyncio event loops.

docs/reference/markers/index.rst

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Markers
33
=======
44

5+
.. _reference/markers/asyncio:
6+
57
``pytest.mark.asyncio``
68
=======================
79
A coroutine or async generator with this marker is treated as a test function by pytest.

0 commit comments

Comments
 (0)