summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_logging.py
diff options
context:
space:
mode:
authorBrian Curtin <brian@python.org>2011-11-07 20:19:46 (GMT)
committerBrian Curtin <brian@python.org>2011-11-07 20:19:46 (GMT)
commitca0fbc02e9971ead5436473e15320652c1fd97c8 (patch)
tree4b54cf71920a50bceed96d6f575ed1cbf0abac17 /Lib/test/test_logging.py
parentc1b65d1831265534cb1613d7bf0ad7643fddb795 (diff)
parentca6befb77f007ee74137bcbfc26f3fe1345bd886 (diff)
downloadcpython-ca0fbc02e9971ead5436473e15320652c1fd97c8.zip
cpython-ca0fbc02e9971ead5436473e15320652c1fd97c8.tar.gz
cpython-ca0fbc02e9971ead5436473e15320652c1fd97c8.tar.bz2
branch merge
Diffstat (limited to 'Lib/test/test_logging.py')
-rw-r--r--Lib/test/test_logging.py23
1 files changed, 18 insertions, 5 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index ed22d91..25ca0b8 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -49,6 +49,7 @@ import weakref
try:
import threading
# The following imports are needed only for tests which
+ # require threading
import asynchat
import asyncore
import errno
@@ -95,9 +96,7 @@ class BaseTest(unittest.TestCase):
finally:
logging._releaseLock()
- # Set two unused loggers: one non-ASCII and one Unicode.
- # This is to test correct operation when sorting existing
- # loggers in the configuration code. See issue 8201.
+ # Set two unused loggers
self.logger1 = logging.getLogger("\xab\xd7\xbb")
self.logger2 = logging.getLogger("\u013f\u00d6\u0047")
@@ -310,8 +309,6 @@ class BuiltinLevelsTest(BaseTest):
('INF.BADPARENT', 'INFO', '4'),
])
- def test_invalid_name(self):
- self.assertRaises(TypeError, logging.getLogger, any)
class BasicFilterTest(BaseTest):
@@ -3514,6 +3511,22 @@ class LoggerTest(BaseTest):
self.addCleanup(setattr, self.logger.manager, 'disable', old_disable)
self.assertFalse(self.logger.isEnabledFor(22))
+ def test_root_logger_aliases(self):
+ root = logging.getLogger()
+ self.assertIs(root, logging.root)
+ self.assertIs(root, logging.getLogger(None))
+ self.assertIs(root, logging.getLogger(''))
+ self.assertIs(root, logging.getLogger('foo').root)
+ self.assertIs(root, logging.getLogger('foo.bar').root)
+ self.assertIs(root, logging.getLogger('foo').parent)
+
+ self.assertIsNot(root, logging.getLogger('\0'))
+ self.assertIsNot(root, logging.getLogger('foo.bar').parent)
+
+ def test_invalid_names(self):
+ self.assertRaises(TypeError, logging.getLogger, any)
+ self.assertRaises(TypeError, logging.getLogger, b'foo')
+
class BaseFileTest(BaseTest):
"Base class for handler tests that write log files"