Skip to content

Commit ae0dfa4

Browse files
committed
add a simple test to run
1 parent 990e7ba commit ae0dfa4

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

tests/test_run.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import qasync
2+
import asyncio
3+
import os
4+
from qasync import QApplication
5+
6+
def test_run_with_contextmanager(application):
7+
async def coro():
8+
event_loop = asyncio.get_event_loop()
9+
assert type(event_loop).__name__ == "QIOCPEventLoop" if os.name == 'nt' else "QSelectorEventLoop"
10+
await asyncio.sleep(0)
11+
12+
qasync.run(coro())
13+
14+
try:
15+
event_loop = asyncio.get_event_loop()
16+
except:
17+
event_loop = None
18+
assert type(event_loop).__name__ != "QIOCPEventLoop" if os.name == 'nt' else "QSelectorEventLoop"

0 commit comments

Comments
 (0)