Skip to content

Commit aa1b0bc

Browse files
committed
[refactor] Inlined function "_is_coroutine".
There's not much benefit of this function, given that asyncio.iscoroutinefunction has an equally expressive name and isn't much longer to type out. Signed-off-by: Michael Seifert <[email protected]>
1 parent ee10388 commit aa1b0bc

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

pytest_asyncio/plugin.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,8 @@ def _make_asyncio_fixture_function(obj: Any) -> None:
157157
obj._force_asyncio_fixture = True
158158

159159

160-
def _is_coroutine(obj: Any) -> bool:
161-
"""Check to see if an object is really an asyncio coroutine."""
162-
return asyncio.iscoroutinefunction(obj)
163-
164-
165160
def _is_coroutine_or_asyncgen(obj: Any) -> bool:
166-
return _is_coroutine(obj) or inspect.isasyncgenfunction(obj)
161+
return asyncio.iscoroutinefunction(obj) or inspect.isasyncgenfunction(obj)
167162

168163

169164
def _get_asyncio_mode(config: Config) -> Mode:
@@ -580,7 +575,7 @@ def pytest_collection_modifyitems(
580575

581576

582577
def _hypothesis_test_wraps_coroutine(function: Any) -> bool:
583-
return _is_coroutine(function.hypothesis.inner_test)
578+
return asyncio.iscoroutinefunction(function.hypothesis.inner_test)
584579

585580

586581
_REDEFINED_EVENT_LOOP_FIXTURE_WARNING = dedent(

0 commit comments

Comments
 (0)