You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Fixed double wrapping of inherited Hypothesis tests.
Pytest-asyncio identifies Hypothesis test cases by their `is_hypothesis_test` flag. When setting up an async Hypothesis test pytest-asyncio replaces wraps function's `hypothesis.inner_test` attribute. The the top level function never changes.
When a Hypothesis test case is defined in a base class and inherited by subclasses, the test is collected in each subclass. Since the top-level Hypothesis test never changes, its inner test will be wrapped multiple times.
Double wrapping leads to execution errors caused by stale (closed) event loops in all test executions after the first.
This change adds an `original_test_function` attribute to the async function wrapper, in order to keep track of the original Hypothesis test. When re-wrapping would occur in subclasses pytest-asyncio wraps the original test function rather than the wrapper function.
Closespytest-dev#231
Signed-off-by: Michael Seifert <[email protected]>
- Fixed an issue that prevented inherited asynchronous Hypothesis tests from working. `#231 <https://github.com/pytest-dev/pytest-asyncio/issues/231>`_
0 commit comments