Skip to content

Commit 2f02fbd

Browse files
TimothyFitzseifertm
authored andcommitted
Add test for hypothesis event_loop reuse.
1 parent dee505e commit 2f02fbd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/test_hypothesis_integration.py

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Tests for the Hypothesis integration, which wraps async functions in a
22
sync shim for Hypothesis.
33
"""
4+
import asyncio
45

56
import pytest
67

@@ -25,3 +26,11 @@ async def test_mark_outer(n):
2526
async def test_mark_and_parametrize(x, y):
2627
assert x is None
2728
assert y in (1, 2)
29+
30+
31+
@given(st.integers())
32+
@pytest.mark.asyncio
33+
async def test_can_use_fixture_provided_event_loop(event_loop, n):
34+
semaphore = asyncio.Semaphore(value=0, loop=event_loop)
35+
event_loop.call_soon(semaphore.release)
36+
await semaphore.acquire()

0 commit comments

Comments
 (0)