Skip to content

Commit 1e4abfc

Browse files
committed
[refactor] Inlined function "_hypothesis_test_wraps_coroutine".
This causes Hypothesis-specific code to be located in roughly the same place, increasing code locality. Signed-off-by: Michael Seifert <[email protected]>
1 parent aa1b0bc commit 1e4abfc

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

pytest_asyncio/plugin.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,9 @@ class AsyncHypothesisTest(PytestAsyncioFunction):
435435
@staticmethod
436436
def _can_substitute(item: pytest.Function) -> bool:
437437
func = item.obj
438-
return _is_hypothesis_test(func) and _hypothesis_test_wraps_coroutine(func)
438+
return _is_hypothesis_test(func) and asyncio.iscoroutinefunction(
439+
func.hypothesis.inner_test
440+
)
439441

440442
def runtest(self) -> None:
441443
if self.get_closest_marker("asyncio"):
@@ -574,10 +576,6 @@ def pytest_collection_modifyitems(
574576
item.add_marker("asyncio")
575577

576578

577-
def _hypothesis_test_wraps_coroutine(function: Any) -> bool:
578-
return asyncio.iscoroutinefunction(function.hypothesis.inner_test)
579-
580-
581579
_REDEFINED_EVENT_LOOP_FIXTURE_WARNING = dedent(
582580
"""\
583581
The event_loop fixture provided by pytest-asyncio has been redefined in

0 commit comments

Comments
 (0)