diff options
author | Jamie Phan <jamie@ordinarylab.dev> | 2024-02-19 00:01:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-19 00:01:00 (GMT) |
commit | 53d5e67804227d541ed2f9e8efea8de5d70cb1ec (patch) | |
tree | 7be39b738d6e8e039bc1507e2ebbc9dc0f080f08 /Lib/test/test_asyncio | |
parent | edea0e7d9938139d53af84de817097bc12bb8f92 (diff) | |
download | cpython-53d5e67804227d541ed2f9e8efea8de5d70cb1ec.zip cpython-53d5e67804227d541ed2f9e8efea8de5d70cb1ec.tar.gz cpython-53d5e67804227d541ed2f9e8efea8de5d70cb1ec.tar.bz2 |
gh-111358: Fix timeout behaviour in BaseEventLoop.shutdown_default_executor (#115622)
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r-- | Lib/test/test_asyncio/test_base_events.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py index 82071ed..4cd872d 100644 --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -231,6 +231,22 @@ class BaseEventLoopTests(test_utils.TestCase): self.assertIsNone(self.loop._default_executor) + def test_shutdown_default_executor_timeout(self): + class DummyExecutor(concurrent.futures.ThreadPoolExecutor): + def shutdown(self, wait=True, *, cancel_futures=False): + if wait: + time.sleep(0.1) + + self.loop._process_events = mock.Mock() + self.loop._write_to_self = mock.Mock() + executor = DummyExecutor() + self.loop.set_default_executor(executor) + + with self.assertWarnsRegex(RuntimeWarning, + "The executor did not finishing joining"): + self.loop.run_until_complete( + self.loop.shutdown_default_executor(timeout=0.01)) + def test_call_soon(self): def cb(): pass |