Closed
Description
hypothesis
exits early when used on pytest-asyncio tests, complaining that the test returns a coroutine instead of None. This issue talks about how trio added support for hypothesis: HypothesisWorks/hypothesis#968
I can work around this with a decorator:
def run_in_event_loop(async_func):
@functools.wraps(async_func)
def wrapped(operations, queue_size, add_size, get_size, event_loop):
event_loop.run_until_complete(asyncio.ensure_future(
async_func(operations, queue_size, add_size, get_size, event_loop),
loop=event_loop,
))
return wrapped
@hypothesis.given(...)
@run_in_event_loop
@pytest.mark.asyncio
async def test_...
But it looks like the recommended approach is to tinker with the hypothesis attribute added to the test, like: https://github.com/python-trio/pytest-trio/pull/44/files#diff-aacce3c1178656a02aecc59c94209433R231
Is this something pytest-asyncio is interested in supporting?