summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio
diff options
context:
space:
mode:
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>2022-11-12 07:17:53 (GMT)
committerGitHub <noreply@github.com>2022-11-12 07:17:53 (GMT)
commitaa874326d86734606a1930e7f48e2ee204cae0b6 (patch)
treee0f68cc2b753c4b5f43ec278ed5e95650df88b9e /Lib/test/test_asyncio
parente02cc6d42aee1f0a9ee629f76576eee478224d9d (diff)
downloadcpython-aa874326d86734606a1930e7f48e2ee204cae0b6.zip
cpython-aa874326d86734606a1930e7f48e2ee204cae0b6.tar.gz
cpython-aa874326d86734606a1930e7f48e2ee204cae0b6.tar.bz2
GH-94597: add deprecation warnings for subclassing `AbstractChildWatcher` (#99386)
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r--Lib/test/test_asyncio/test_unix_events.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/test/test_asyncio/test_unix_events.py b/Lib/test/test_asyncio/test_unix_events.py
index d806ed4..93e8611 100644
--- a/Lib/test/test_asyncio/test_unix_events.py
+++ b/Lib/test/test_asyncio/test_unix_events.py
@@ -1108,6 +1108,11 @@ class UnixWritePipeTransportTests(test_utils.TestCase):
class AbstractChildWatcherTests(unittest.TestCase):
+ def test_warns_on_subclassing(self):
+ with self.assertWarns(DeprecationWarning):
+ class MyWatcher(asyncio.AbstractChildWatcher):
+ pass
+
def test_not_implemented(self):
f = mock.Mock()
watcher = asyncio.AbstractChildWatcher()
@@ -1747,7 +1752,9 @@ class PolicyTests(unittest.TestCase):
self.assertIsInstance(policy.get_event_loop(),
asyncio.AbstractEventLoop)
- watcher = policy.get_child_watcher()
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore", DeprecationWarning)
+ watcher = policy.get_child_watcher()
self.assertIsInstance(watcher, asyncio.SafeChildWatcher)
self.assertIsNone(watcher._loop)