Skip to content

Commit 98c6bf8

Browse files
committed
add simple tests for asyncio_clock mark and clock_event_loop fixture
1 parent 8841d15 commit 98c6bf8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/test_simple_35.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,24 @@ def test_async_close_loop(event_loop):
8888
return 'ok'
8989

9090

91+
@pytest.mark.asyncio_clock
92+
async def test_mark_asyncio_clock():
93+
"""
94+
Test that coroutines marked with asyncio_clock are run with a ClockEventLoop
95+
"""
96+
import pytest_asyncio
97+
assert isinstance(asyncio.get_event_loop(), pytest_asyncio.plugin.ClockEventLoop)
98+
99+
100+
def test_clock_loop_loop_fixture(clock_event_loop):
101+
"""
102+
Test that the clock_event_loop fixture returns a proper instance of the loop
103+
"""
104+
import pytest_asyncio
105+
assert isinstance(asyncio.get_event_loop(), pytest_asyncio.plugin.ClockEventLoop)
106+
clock_event_loop.close()
107+
return 'ok'
108+
91109

92110
@pytest.mark.asyncio_clock
93111
async def test_clock_loop_advance_time(clock_event_loop):

0 commit comments

Comments
 (0)