File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ def pytest_fixture_setup(fixturedef): # type: ignore[no-untyped-def]
106
106
if inspect .isasyncgenfunction (func ):
107
107
# async generator fixture
108
108
is_async_gen = True
109
- elif asyncio .iscoroutinefunction (func ):
109
+ elif inspect .iscoroutinefunction (func ):
110
110
# regular async fixture
111
111
is_async_gen = False
112
112
else :
@@ -216,14 +216,14 @@ def _passthrough_loop_context(
216
216
217
217
def pytest_pycollect_makeitem (collector , name , obj ): # type: ignore[no-untyped-def]
218
218
"""Fix pytest collecting for coroutines."""
219
- if collector .funcnamefilter (name ) and asyncio .iscoroutinefunction (obj ):
219
+ if collector .funcnamefilter (name ) and inspect .iscoroutinefunction (obj ):
220
220
return list (collector ._genfunctions (name , obj ))
221
221
222
222
223
223
def pytest_pyfunc_call (pyfuncitem ): # type: ignore[no-untyped-def]
224
224
"""Run coroutines in an event loop instead of a normal function call."""
225
225
fast = pyfuncitem .config .getoption ("--aiohttp-fast" )
226
- if asyncio .iscoroutinefunction (pyfuncitem .function ):
226
+ if inspect .iscoroutinefunction (pyfuncitem .function ):
227
227
existing_loop = pyfuncitem .funcargs .get (
228
228
"proactor_loop"
229
229
) or pyfuncitem .funcargs .get ("loop" , None )
Original file line number Diff line number Diff line change 4
4
import functools
5
5
import hashlib
6
6
import html
7
+ import inspect
7
8
import keyword
8
9
import os
9
10
import re
@@ -174,15 +175,15 @@ def __init__(
174
175
if expect_handler is None :
175
176
expect_handler = _default_expect_handler
176
177
177
- assert asyncio .iscoroutinefunction (
178
+ assert inspect .iscoroutinefunction (
178
179
expect_handler
179
180
), f"Coroutine is expected, got { expect_handler !r} "
180
181
181
182
method = method .upper ()
182
183
if not HTTP_METHOD_RE .match (method ):
183
184
raise ValueError (f"{ method } is not allowed HTTP method" )
184
185
185
- if asyncio .iscoroutinefunction (handler ):
186
+ if inspect .iscoroutinefunction (handler ):
186
187
pass
187
188
elif isinstance (handler , type ) and issubclass (handler , AbstractView ):
188
189
pass
Original file line number Diff line number Diff line change 1
1
"""Async gunicorn worker for aiohttp.web"""
2
2
3
3
import asyncio
4
+ import inspect
4
5
import os
5
6
import re
6
7
import signal
@@ -68,7 +69,7 @@ async def _run(self) -> None:
68
69
runner = None
69
70
if isinstance (self .wsgi , Application ):
70
71
app = self .wsgi
71
- elif asyncio .iscoroutinefunction (self .wsgi ):
72
+ elif inspect .iscoroutinefunction (self .wsgi ):
72
73
wsgi = await self .wsgi ()
73
74
if isinstance (wsgi , web .AppRunner ):
74
75
runner = wsgi
You can’t perform that action at this time.
0 commit comments