Skip to content

Conversation

@stj
Copy link

@stj stj commented Dec 5, 2019

Work is heavily inspired by pytest-asyncio

Run into the issue that async tests decorated with hypothesis did not run. After digging into this a bit I found above commit in pytest-asyncio and hypothesis.

if getattr(method, "is_hypothesis_test", False) and asyncio.iscoroutinefunction(
method.hypothesis.inner_test
):
method.hypothesis.inner_test = wrap_in_sync(method.hypothesis.inner_test)
Copy link
Contributor

@Kentzo Kentzo Dec 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's is the type of method when is_hypothesis_test is true? Is it something that any of the inspect.iscoroutinefunction / inspect.iscoroutine / inspect.isawaitable functions recognize?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is just a normal function/callable. Hypothesis given decorator will "swallow" the coroutine and replace it with a normal function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And what would be the result of method() then? A coroutine / awaitable?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I recall correct it will be None and a python warning when debug is true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants