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- # © 2018 Gerard Marull-Paretas <gerard@teslabs.com>
2- # © 2014 Mark Harviston <mark.harviston@gmail.com>
3- # © 2014 Arve Knudsen <arve.knudsen@gmail.com>
4- # BSD License
1+ """
2+ Copyright (c) 2018 Gerard Marull-Paretas <gerard@teslabs.com>
3+ Copyright (c) 2014 Mark Harviston <mark.harviston@gmail.com>
4+ Copyright (c) 2014 Arve Knudsen <arve.knudsen@gmail.com>
5+
6+ BSD License
7+ """
58
6- import os
79import logging
8- from pytest import fixture
10+ import os
911
12+ from pytest import fixture
1013
1114logging .basicConfig (
1215 level = logging .DEBUG , format = "%(levelname)s\t %(filename)s:%(lineno)s %(message)s"
Original file line number Diff line number Diff line change 55
66import asyncio
77import ctypes
8- import threading
98import logging
109import multiprocessing
1110import os
1211import socket
1312import subprocess
1413import sys
14+ import threading
1515import time
1616from concurrent .futures import ProcessPoolExecutor , ThreadPoolExecutor
1717
@@ -809,6 +809,23 @@ async def mycoro():
809809 assert "seconds" in msg
810810
811811
812+ def test_run_until_complete_returns_future_result (loop ):
813+ async def coro ():
814+ await asyncio .sleep (0 )
815+ return 42
816+
817+ assert loop .run_until_complete (asyncio .wait_for (coro (), timeout = 0.1 )) == 42
818+
819+
820+ def test_run_forever_custom_exit_code (loop , application ):
821+ orig_exec = application .exec
822+ application .exec = lambda : 42
823+ try :
824+ assert loop .run_forever () == 42
825+ finally :
826+ application .exec = orig_exec
827+
828+
812829@pytest .mark .skipif (sys .version_info < (3 , 12 ), reason = "Requires Python 3.12+" )
813830def test_asyncio_run (application ):
814831 """Test that QEventLoop is compatible with asyncio.run()"""
You can’t perform that action at this time.
0 commit comments