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_logging.py b/Lib/test/test_logging.py
index ee00a32..0cc1fc4 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -54,13 +54,16 @@
 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: