Support async tests which use Hypothesis#145
Open
stj wants to merge 1 commit intoMartiusweb:masterfrom
Open
Conversation
Work is heavily inspired by pytest-asyncio pytest-dev/pytest-asyncio@d4c1b92
Kentzo
reviewed
Dec 9, 2019
| 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) |
Contributor
There was a problem hiding this comment.
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?
Author
There was a problem hiding this comment.
It is just a normal function/callable. Hypothesis given decorator will "swallow" the coroutine and replace it with a normal function.
Contributor
There was a problem hiding this comment.
And what would be the result of method() then? A coroutine / awaitable?
Author
There was a problem hiding this comment.
If I recall correct it will be None and a python warning when debug is true.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.