]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-44498: suppress DeprecationWarnings for asynchat, asyncore and smtpd in tests...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 24 Jun 2021 23:38:01 +0000 (16:38 -0700)
committerGitHub <noreply@github.com>
Thu, 24 Jun 2021 23:38:01 +0000 (00:38 +0100)
(cherry picked from commit 22e7effad571f8e524d2f71ff55bbf2a25306753)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Lib/test/test_asynchat.py
Lib/test/test_asyncore.py
Lib/test/test_ftplib.py
Lib/test/test_logging.py
Lib/test/test_os.py
Lib/test/test_poplib.py
Lib/test/test_smtpd.py
Lib/test/test_smtplib.py
Lib/test/test_ssl.py

index b32edddc7d5505b1badcc45c3147c736f8a09808..973ac1f7d97c9b083aca6c0b98c4ee524f210009 100644 (file)
@@ -4,8 +4,6 @@ from test import support
 from test.support import socket_helper
 from test.support import threading_helper
 
-import asynchat
-import asyncore
 import errno
 import socket
 import sys
@@ -14,6 +12,12 @@ import time
 import unittest
 import unittest.mock
 
+import warnings
+with warnings.catch_warnings():
+    warnings.simplefilter('ignore', DeprecationWarning)
+    import asynchat
+    import asyncore
+
 HOST = socket_helper.HOST
 SERVER_QUIT = b'QUIT\n'
 
index 3bd904d1774bc36ce96847a314cc03c6d75d2b4c..ecd1e120ecb515c53ff315206c36d16b98c5fb37 100644 (file)
@@ -1,4 +1,3 @@
-import asyncore
 import unittest
 import select
 import os
@@ -19,6 +18,11 @@ from io import BytesIO
 if support.PGO:
     raise unittest.SkipTest("test is not helpful for PGO")
 
+import warnings
+with warnings.catch_warnings():
+    warnings.simplefilter('ignore', DeprecationWarning)
+    import asyncore
+
 
 HAS_UNIX_SOCKETS = hasattr(socket, 'AF_UNIX')
 
index a48b429ca38027327166407e765bc1bf43642ea0..3492ba44f21034ff1331766ae2d9f58abbdfc6b5 100644 (file)
@@ -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 socket_helper
 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
index ee00a32026f65ec39c72f73f4f1aa60b198f3d20..0cc1fc4d167902e3e7a0d2e7b4aa6412aba2dfa5 100644 (file)
@@ -54,13 +54,16 @@ import unittest
 import warnings
 import weakref
 
-import asyncore
 from http.server import HTTPServer, BaseHTTPRequestHandler
-import smtpd
 from urllib.parse import urlparse, parse_qs
 from socketserver import (ThreadingUDPServer, DatagramRequestHandler,
                           ThreadingTCPServer, StreamRequestHandler)
 
+with warnings.catch_warnings():
+    warnings.simplefilter('ignore', DeprecationWarning)
+    import asyncore
+    import smtpd
+
 try:
     import win32evtlog, win32evtlogutil, pywintypes
 except ImportError:
index 8b3d1feb78fe36d26fdfebd027af83ee55e629d3..684e308ad3a0596af73d3f8103bc4c7ff4d10526 100644 (file)
@@ -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 threading_helper
 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:
index c5ae9f77e4f0062faf1f487cc80a6402db01c310..8dd6ea69c0d1a01036f7d921d868754db7190237 100644 (file)
@@ -4,8 +4,6 @@
 # a real test suite
 
 import poplib
-import asyncore
-import asynchat
 import socket
 import os
 import errno
@@ -17,6 +15,12 @@ from test.support import hashlib_helper
 from test.support import socket_helper
 from test.support import threading_helper
 
+import warnings
+with warnings.catch_warnings():
+    warnings.simplefilter('ignore', DeprecationWarning)
+    import asynchat
+    import asyncore
+
 HOST = socket_helper.HOST
 PORT = 0
 
index 6303192d1b26cc33d2f3ee7ee74486149f0bb632..d2e150d535ff6cb9d2921eecb8096773ba4fda6c 100644 (file)
@@ -5,8 +5,12 @@ from test.support import socket_helper
 from test.support import warnings_helper
 import socket
 import io
-import smtpd
-import asyncore
+
+import warnings
+with warnings.catch_warnings():
+    warnings.simplefilter('ignore', DeprecationWarning)
+    import smtpd
+    import asyncore
 
 
 class DummyServer(smtpd.SMTPServer):
index f3d33ab0772dd3a215d8b8e2fad75c8d47c91405..483d747ee6a49557d1623b12013a9838217b50a1 100644 (file)
@@ -1,4 +1,3 @@
-import asyncore
 import base64
 import email.mime.text
 from email.message import EmailMessage
@@ -7,7 +6,6 @@ import email.utils
 import hashlib
 import hmac
 import socket
-import smtpd
 import smtplib
 import io
 import re
@@ -25,6 +23,12 @@ from test.support import socket_helper
 from test.support import threading_helper
 from unittest.mock import Mock
 
+import warnings
+with warnings.catch_warnings():
+    warnings.simplefilter('ignore', DeprecationWarning)
+    import asyncore
+    import smtpd
+
 HOST = socket_helper.HOST
 
 if sys.platform == 'darwin':
index a89768f24b2b0aaca6c0f9836c7cc8a56a3aff74..fab382f43c7a4b86c43f3e882bb062183336bb85 100644 (file)
@@ -21,7 +21,6 @@ import pprint
 import urllib.request
 import threading
 import traceback
-import asyncore
 import weakref
 import platform
 import sysconfig
@@ -31,6 +30,11 @@ try:
 except ImportError:
     ctypes = None
 
+import warnings
+with warnings.catch_warnings():
+    warnings.simplefilter('ignore', DeprecationWarning)
+    import asyncore
+
 ssl = import_helper.import_module("ssl")
 import _ssl