Fully support async tests and fixtures#485
Merged
MatthewMckee4 merged 9 commits intomainfrom Feb 17, 2026
Merged
Conversation
Async test functions, async fixtures, and async generator fixtures were silently passing without executing because coroutines were never awaited. This adds `asyncio.run()` integration at each call site so async Python code is properly executed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merging this PR will not alter performance
|
Patch hypothesis.inner_test with a sync wrapper that uses asyncio.run() so that @given can call async test functions without raising InvalidArgument. - Add patch_async_test_function() helper in utils.rs - Use it in execute_test_variant to detect and patch wrapped async tests - Extract test venv deps into requirements.txt (pytest + hypothesis) - Add integration test for @given + async def
c5ef277 to
404e752
Compare
321915b to
2f4165a
Compare
Set __signature__ directly on the closure so inspect.signature() works for built-in function types across Python versions.
PyCFunction closures lack the signature metadata and calling conventions that Hypothesis requires on Python 3.14. Use inline Python with functools.wraps instead.
384924c to
f9acb36
Compare
The ci profile configures retries=3 and fail-fast=false, but CI was running with the default profile which has neither.
f9acb36 to
56fd2c1
Compare
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.
Summary
asyncio.run()support soasync def test_*()functions are properly awaited instead of silently passingasyncio.run()__anext__()+asyncio.run()for both setup and teardownCloses #484
Test plan
test_async_function— basic async test that passestest_async_function_with_assertion_error— async test that fails with assertiontest_async_fixture— async non-generator fixture with async testtest_async_generator_fixture— async generator fixture with setup/teardown verificationtest_async_test_with_sync_fixture— async test consuming a sync fixturetest_sync_test_with_async_fixture— sync test consuming an async fixtureuvx prek run -apasses🤖 Generated with Claude Code