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 @@ -192,10 +192,14 @@ def pytest_pyfunc_call(pyfuncitem: "Function"):
192192 funcargs = pyfuncitem .funcargs
193193 testargs = {arg : funcargs [arg ] for arg in pyfuncitem ._fixtureinfo .argnames }
194194 result = testfunction (** testargs )
195- if (
196- hasattr (result , "__await__" ) or hasattr (result , "__aiter__" )
197- ) and not async_ok_in_stdlib :
198- async_warn (pyfuncitem .nodeid )
195+ if hasattr (result , "__await__" ) or hasattr (result , "__aiter__" ):
196+ if async_ok_in_stdlib :
197+ # todo: investigate moving this to the unittest plugin
198+ # by a test call result hook
199+ testcase = testfunction .__self__
200+ testcase ._callMaybeAsync (lambda : result )
201+ else :
202+ async_warn (pyfuncitem .nodeid )
199203 return True
200204
201205
You can’t perform that action at this time.
0 commit comments