File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import qasync
21import asyncio
32import os
4- from qasync import QApplication
3+
4+ import pytest
5+
6+ import qasync
7+
58
69def test_run_with_contextmanager (application ):
710 async def coro ():
811 event_loop = asyncio .get_event_loop ()
9- assert type (event_loop ).__name__ == "QIOCPEventLoop" if os .name == 'nt' else "QSelectorEventLoop"
12+ assert (
13+ type (event_loop ).__name__ == "QIOCPEventLoop"
14+ if os .name == "nt"
15+ else "QSelectorEventLoop"
16+ )
1017 await asyncio .sleep (0 )
1118
19+ asyncio .set_event_loop (None )
1220 qasync .run (coro ())
1321
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"
22+ with pytest .raises (RuntimeError ):
23+ _ = asyncio .get_event_loop ()
You can’t perform that action at this time.
0 commit comments