File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -194,10 +194,14 @@ def pytest_pyfunc_call(pyfuncitem: "Function"):
194
194
funcargs = pyfuncitem .funcargs
195
195
testargs = {arg : funcargs [arg ] for arg in pyfuncitem ._fixtureinfo .argnames }
196
196
result = testfunction (** testargs )
197
- if (
198
- hasattr (result , "__await__" ) or hasattr (result , "__aiter__" )
199
- ) and not async_ok_in_stdlib :
200
- async_warn (pyfuncitem .nodeid )
197
+ if hasattr (result , "__await__" ) or hasattr (result , "__aiter__" ):
198
+ if async_ok_in_stdlib :
199
+ # todo: investigate moving this to the unittest plugin
200
+ # by a test call result hook
201
+ testcase = testfunction .__self__
202
+ testcase ._callMaybeAsync (lambda : result )
203
+ else :
204
+ async_warn (pyfuncitem .nodeid )
201
205
return True
202
206
203
207
You can’t perform that action at this time.
0 commit comments