Skip to content

Commit e92efad

Browse files
committed
[feat] Improve Hypothesis test detection.
As suggested in #758 (comment) Signed-off-by: Michael Seifert <[email protected]>
1 parent e3f5250 commit e92efad

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pytest_asyncio/plugin.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,11 @@ class AsyncHypothesisTest(PytestAsyncioFunction):
481481
@staticmethod
482482
def _can_substitute(item: Function) -> bool:
483483
func = item.obj
484-
return getattr(
485-
func, "is_hypothesis_test", False
486-
) and asyncio.iscoroutinefunction(func.hypothesis.inner_test)
484+
return (
485+
getattr(func, "is_hypothesis_test", False) # type: ignore[return-value]
486+
and getattr(func, "hypothesis", None)
487+
and asyncio.iscoroutinefunction(func.hypothesis.inner_test)
488+
)
487489

488490
def runtest(self) -> None:
489491
self.obj.hypothesis.inner_test = wrap_in_sync(

0 commit comments

Comments
 (0)