bpo-44498: suppress DeprecationWarnings for asynchat, asyncore and smtpd in tests (GH-26905) (GH-26907)
(cherry picked from commit 22e7effad571f8e524d2f71ff55bbf2a25306753)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 8b3d1fe..684e308 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -2,8 +2,6 @@
# does add tests for a few functions which have been determined to be more
# portable than they had been thought to be.
-import asynchat
-import asyncore
import codecs
import contextlib
import decimal
@@ -39,6 +37,11 @@
from test.support import warnings_helper
from platform import win32_is_iot
+with warnings.catch_warnings():
+ warnings.simplefilter('ignore', DeprecationWarning)
+ import asynchat
+ import asyncore
+
try:
import resource
except ImportError: