Skip to content

Commit 36b09cf

Browse files
authored
more tests!
1 parent 2471d9c commit 36b09cf

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tests/test_run.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
import asyncio
22
import os
3+
from unittest.mock import ANY
34

45
import pytest
56

67
import qasync
78

89
@pytest.fixture
910
def get_event_loop_coro(expected_loop):
10-
async def coro():
11+
async def coro(expected_debug):
1112
event_loop = asyncio.get_event_loop()
1213

1314
assert type(event_loop).__name__ == expected_loop
15+
assert event_loop.get_debug() == expected_debug
1416
await asyncio.sleep(0)
1517
return coro
1618

@@ -20,13 +22,17 @@ def expected_loop():
2022

2123
def test_run_with_contextmanager(get_event_loop_coro):
2224
asyncio.set_event_loop(None)
23-
qasync.run(get_event_loop_coro())
25+
qasync.run(get_event_loop_coro(ANY))
2426

2527
with pytest.raises(RuntimeError):
2628
_ = asyncio.get_event_loop()
2729

28-
def test_run_reset_policy(get_event_loop_coro, expected_loop):
30+
def test_run_reset_policy(get_event_loop_coro):
2931
old_loop = asyncio.new_event_loop()
30-
qasync.run(get_event_loop_coro())
32+
qasync.run(get_event_loop_coro(ANY))
3133
new_loop = asyncio.new_event_loop()
3234
assert type(old_loop) == type(new_loop)
35+
36+
def test_run_debug(get_event_loop_coro):
37+
qasync.run(get_event_loop_coro(True), debug=True)
38+
qasync.run(get_event_loop_coro(False), debug=False)

0 commit comments

Comments
 (0)