File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,9 +23,10 @@ Homepage = "https://github.com/bmerry/async-solipsism"
2323
2424[project .optional-dependencies ]
2525test = [
26+ " backports.asyncio.runner; python_version<'3.11'" ,
2627 " pre-commit" ,
2728 " pytest" ,
28- " pytest-asyncio>=0.23,<1.0 " ,
29+ " pytest-asyncio>=0.23" ,
2930 " pytest-mock" ,
3031]
3132
Original file line number Diff line number Diff line change 11# This file was autogenerated by uv via the following command:
22# uv pip compile --python-version=3.10 --universal --output-file=requirements.txt --extra=test pyproject.toml
3+ backports-asyncio-runner == 1.2.0 ; python_full_version < '3.11'
4+ # via async-solipsism (pyproject.toml)
35cfgv == 3.5.0
46 # via pre-commit
57colorama == 0.4.6 ; sys_platform == 'win32'
Original file line number Diff line number Diff line change @@ -219,6 +219,17 @@ def _stop_serving(self, sock):
219219 self .__listening_sockets .pop (addr )
220220 super ()._stop_serving (sock )
221221
222+ async def shutdown_default_executor (self , timeout = None ):
223+ # The default implementation uses an asyncio timeout, which
224+ # would complete immediately without giving the executor
225+ # time to shut down. We ignore the timeout and just shut
226+ # things down synchronously. This is based on the code in
227+ # CPython.
228+ self ._executor_shutdown_called = True
229+ if self ._default_executor is None :
230+ return
231+ self ._default_executor .shutdown (wait = True )
232+
222233
223234class EventLoopPolicy (asyncio .DefaultEventLoopPolicy ):
224235 def new_event_loop (self ) -> EventLoop :
Original file line number Diff line number Diff line change 1717
1818import asyncio
1919import concurrent .futures
20+ import sys
2021import threading
22+ if sys .version_info < (3 , 11 ):
23+ from backports .asyncio .runner import Runner
24+ else :
25+ from asyncio import Runner
2126
2227import pytest
2328
@@ -36,12 +41,13 @@ async def test_sleep():
3641 assert event_loop .time () == 2.0
3742
3843
39- def test_sleep_forever (event_loop ):
44+ def test_sleep_forever ():
4045 async def zzz ():
4146 await asyncio .Future ()
4247
43- with pytest .raises (async_solipsism .SleepForeverError ):
44- event_loop .run_until_complete (zzz ())
48+ with Runner (loop_factory = async_solipsism .EventLoop ) as runner :
49+ with pytest .raises (async_solipsism .SleepForeverError ):
50+ runner .run (zzz ())
4551
4652
4753@pytest .mark .parametrize (
You can’t perform that action at this time.
0 commit comments