Skip to content

Commit 0698aee

Browse files
committed
docs: Removed contradicting information about the event_loop fixture not setting the global event loop.
Signed-off-by: Michael Seifert <[email protected]>
1 parent f13c85f commit 0698aee

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

README.rst

+4-7
Original file line numberDiff line numberDiff line change
@@ -123,19 +123,16 @@ Fixtures
123123

124124
``event_loop``
125125
~~~~~~~~~~~~~~
126-
Creates and injects a new instance of the default asyncio event loop. By
127-
default, the loop will be closed at the end of the test (i.e. the default
128-
fixture scope is ``function``).
126+
Creates a new asyncio event loop based on the current event loop policy. The new loop
127+
is available as the return value of this fixture or via `asyncio.get_running_loop <https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.get_running_loop>`__.
128+
The event loop is closed when the fixture scope ends. The fixture scope defaults
129+
to ``function`` scope.
129130

130131
Note that just using the ``event_loop`` fixture won't make your test function
131132
a coroutine. You'll need to interact with the event loop directly, using methods
132133
like ``event_loop.run_until_complete``. See the ``pytest.mark.asyncio`` marker
133134
for treating test functions like coroutines.
134135

135-
Simply using this fixture will not set the generated event loop as the
136-
default asyncio event loop, or change the asyncio event loop policy in any way.
137-
Use ``pytest.mark.asyncio`` for this purpose.
138-
139136
.. code-block:: python
140137
141138
def test_http_client(event_loop):

0 commit comments

Comments
 (0)