Skip to content

Commit b7e0555

Browse files
committed
[refactor] Inlined function "_is_hypothesis_test".
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 1e4abfc commit b7e0555

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

pytest_asyncio/plugin.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -435,9 +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 asyncio.iscoroutinefunction(
439-
func.hypothesis.inner_test
440-
)
438+
return getattr(
439+
func, "is_hypothesis_test", False
440+
) and asyncio.iscoroutinefunction(func.hypothesis.inner_test)
441441

442442
def runtest(self) -> None:
443443
if self.get_closest_marker("asyncio"):
@@ -744,10 +744,6 @@ def pytest_pyfunc_call(pyfuncitem: pytest.Function) -> Optional[object]:
744744
yield
745745

746746

747-
def _is_hypothesis_test(function: Any) -> bool:
748-
return getattr(function, "is_hypothesis_test", False)
749-
750-
751747
def wrap_in_sync(
752748
pyfuncitem: pytest.Function,
753749
func: Callable[..., Awaitable[Any]],

0 commit comments

Comments
 (0)