summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_logging.py
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2013-03-22 15:19:54 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2013-03-22 15:19:54 (GMT)
commit3f885b543256df8acabc39fa9c28f45dfa6e4979 (patch)
tree8ec84f92fce88e722dd15905b0ff91fa9e73e9d3 /Lib/test/test_logging.py
parentd5537d071cc2acada7220431a0eea5931c2e8a2d (diff)
downloadcpython-3f885b543256df8acabc39fa9c28f45dfa6e4979.zip
cpython-3f885b543256df8acabc39fa9c28f45dfa6e4979.tar.gz
cpython-3f885b543256df8acabc39fa9c28f45dfa6e4979.tar.bz2
Issue #17508: Handled out-of-order handler configuration correctly.
Diffstat (limited to 'Lib/test/test_logging.py')
-rw-r--r--Lib/test/test_logging.py38
1 files changed, 36 insertions, 2 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 2a3c780..bbd4852 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2001-2012 by Vinay Sajip. All Rights Reserved.
+# Copyright 2001-2013 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
@@ -18,7 +18,7 @@
"""Test harness for the logging module. Run all tests.
-Copyright (C) 2001-2012 Vinay Sajip. All Rights Reserved.
+Copyright (C) 2001-2013 Vinay Sajip. All Rights Reserved.
"""
import logging
@@ -1696,6 +1696,36 @@ class ConfigDictTest(BaseTest):
},
}
+ out_of_order = {
+ "version": 1,
+ "formatters": {
+ "mySimpleFormatter": {
+ "format": "%(asctime)s (%(name)s) %(levelname)s: %(message)s"
+ }
+ },
+ "handlers": {
+ "fileGlobal": {
+ "class": "logging.StreamHandler",
+ "level": "DEBUG",
+ "formatter": "mySimpleFormatter"
+ },
+ "bufferGlobal": {
+ "class": "logging.handlers.MemoryHandler",
+ "capacity": 5,
+ "formatter": "mySimpleFormatter",
+ "target": "fileGlobal",
+ "level": "DEBUG"
+ }
+ },
+ "loggers": {
+ "mymodule": {
+ "level": "DEBUG",
+ "handlers": ["bufferGlobal"],
+ "propagate": "true"
+ }
+ }
+ }
+
def apply_config(self, conf):
logging.config.dictConfig(conf)
@@ -1994,6 +2024,10 @@ class ConfigDictTest(BaseTest):
# Original logger output is empty.
self.assert_log_lines([])
+ def test_out_of_order(self):
+ self.apply_config(self.out_of_order)
+ handler = logging.getLogger('mymodule').handlers[0]
+ self.assertIsInstance(handler.target, logging.Handler)
class ManagerTest(BaseTest):
def test_manager_loggerclass(self):