aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_logging.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2020-04-25 11:35:18 +0300
committerGitHub <noreply@github.com>2020-04-25 11:35:18 +0300
commit515fce4fc4bb0d2db97b17df275cf90640017f56 (patch)
tree472b80622f4f7e7a8307c3f4db4122eef549dbd9 /Lib/test/test_logging.py
parent16994912c93e8e5db7365d48b75d67d3f70dd7b2 (diff)
downloadcpython-515fce4fc4bb0d2db97b17df275cf90640017f56.tar.gz
cpython-515fce4fc4bb0d2db97b17df275cf90640017f56.zip
bpo-40275: Avoid importing logging in test.support (GH-19601)
Import logging lazily in assertLogs() in unittest. Move TestHandler from test.support to logging_helper.
Diffstat (limited to 'Lib/test/test_logging.py')
-rw-r--r--Lib/test/test_logging.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 241ed2c91de..e1d0eb8145f 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -44,6 +44,7 @@ import tempfile
from test.support.script_helper import assert_python_ok, assert_python_failure
from test import support
from test.support import socket_helper
+from test.support.logging_helper import TestHandler
import textwrap
import threading
import time
@@ -3524,7 +3525,7 @@ class QueueHandlerTest(BaseTest):
@unittest.skipUnless(hasattr(logging.handlers, 'QueueListener'),
'logging.handlers.QueueListener required for this test')
def test_queue_listener(self):
- handler = support.TestHandler(support.Matcher())
+ handler = TestHandler(support.Matcher())
listener = logging.handlers.QueueListener(self.queue, handler)
listener.start()
try:
@@ -3540,7 +3541,7 @@ class QueueHandlerTest(BaseTest):
# Now test with respect_handler_level set
- handler = support.TestHandler(support.Matcher())
+ handler = TestHandler(support.Matcher())
handler.setLevel(logging.CRITICAL)
listener = logging.handlers.QueueListener(self.queue, handler,
respect_handler_level=True)