diff options
author | Kumar Aditya <kumaraditya@python.org> | 2024-06-23 04:23:23 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-23 04:23:23 (GMT) |
commit | 96ead91f0f0db59a942b8b34da9cc980c05588a2 (patch) | |
tree | 6999459fac5b0203434f35498042bee6777157fe /Lib/test/test_asyncio/test_events.py | |
parent | 4717aaa1a72d1964f1531a7c613f37ce3d9056d9 (diff) | |
download | cpython-96ead91f0f0db59a942b8b34da9cc980c05588a2.zip cpython-96ead91f0f0db59a942b8b34da9cc980c05588a2.tar.gz cpython-96ead91f0f0db59a942b8b34da9cc980c05588a2.tar.bz2 |
GH-120804: Remove `get_child_watcher` and `set_child_watcher` from asyncio (#120818)
Diffstat (limited to 'Lib/test/test_asyncio/test_events.py')
-rw-r--r-- | Lib/test/test_asyncio/test_events.py | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py index 06eb4d3..5b660de 100644 --- a/Lib/test/test_asyncio/test_events.py +++ b/Lib/test/test_asyncio/test_events.py @@ -2212,16 +2212,14 @@ else: class UnixEventLoopTestsMixin(EventLoopTestsMixin): def setUp(self): super().setUp() - with warnings.catch_warnings(): - warnings.simplefilter('ignore', DeprecationWarning) - watcher = asyncio.ThreadedChildWatcher() - watcher.attach_loop(self.loop) - asyncio.set_child_watcher(watcher) + watcher = asyncio.ThreadedChildWatcher() + watcher.attach_loop(self.loop) + policy = asyncio.get_event_loop_policy() + policy._watcher = watcher def tearDown(self): - with warnings.catch_warnings(): - warnings.simplefilter('ignore', DeprecationWarning) - asyncio.set_child_watcher(None) + policy = asyncio.get_event_loop_policy() + policy._watcher = None super().tearDown() @@ -2716,9 +2714,6 @@ class PolicyTests(unittest.TestCase): self.assertRaises(NotImplementedError, policy.get_event_loop) self.assertRaises(NotImplementedError, policy.set_event_loop, object()) self.assertRaises(NotImplementedError, policy.new_event_loop) - self.assertRaises(NotImplementedError, policy.get_child_watcher) - self.assertRaises(NotImplementedError, policy.set_child_watcher, - object()) def test_get_event_loop(self): policy = asyncio.DefaultEventLoopPolicy() @@ -2836,9 +2831,8 @@ class GetEventLoopTestsMixin: def tearDown(self): try: if sys.platform != 'win32': - with warnings.catch_warnings(): - warnings.simplefilter('ignore', DeprecationWarning) - asyncio.set_child_watcher(None) + policy = asyncio.get_event_loop_policy() + policy._watcher = None super().tearDown() finally: |