You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[feat] The "policy" keyword argument to asyncio_event_loop allows passing an iterable of policies.
This causes tests under the _asyncio_event_loop_ mark to be parametrized with the different loop policies.
Signed-off-by: Michael Seifert <m.seifert@digitalernachschub.de>
The ``policy`` keyword argument may also take an iterable of event loop policies. This causes tests under by the `asyncio_event_loop` mark to be parametrized with different policies:
131
+
132
+
.. code-block:: python
133
+
134
+
import asyncio
135
+
136
+
import pytest
137
+
138
+
import pytest_asyncio
139
+
140
+
141
+
@pytest.mark.asyncio_event_loop(
142
+
policy=[
143
+
asyncio.DefaultEventLoopPolicy(),
144
+
uvloop.EventLoopPolicy(),
145
+
]
146
+
)
147
+
classTestWithDifferentLoopPolicies:
148
+
@pytest.mark.asyncio
149
+
asyncdeftest_parametrized_loop(self):
150
+
pass
151
+
152
+
129
153
If no explicit policy is provided, the mark will use the loop policy returned by ``asyncio.get_event_loop_policy()``.
0 commit comments