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_ftplib.py b/Lib/test/test_ftplib.py
index a48b429..3492ba4 100644
--- a/Lib/test/test_ftplib.py
+++ b/Lib/test/test_ftplib.py
@@ -4,8 +4,6 @@
# environment
import ftplib
-import asyncore
-import asynchat
import socket
import io
import errno
@@ -24,6 +22,13 @@
from test.support import warnings_helper
from test.support.socket_helper import HOST, HOSTv6
+import warnings
+with warnings.catch_warnings():
+ warnings.simplefilter('ignore', DeprecationWarning)
+ import asyncore
+ import asynchat
+
+
TIMEOUT = support.LOOPBACK_TIMEOUT
DEFAULT_ENCODING = 'utf-8'
# the dummy data returned by server over the data channel when