summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/test_events.py
diff options
context:
space:
mode:
authorKumar Aditya <kumaraditya@python.org>2024-06-23 04:23:23 (GMT)
committerGitHub <noreply@github.com>2024-06-23 04:23:23 (GMT)
commit96ead91f0f0db59a942b8b34da9cc980c05588a2 (patch)
tree6999459fac5b0203434f35498042bee6777157fe /Lib/test/test_asyncio/test_events.py
parent4717aaa1a72d1964f1531a7c613f37ce3d9056d9 (diff)
downloadcpython-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.py22
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: