]> granicus.if.org Git - python/commitdiff
Added unit test for cfg:// resolution.
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Thu, 4 Feb 2010 21:40:56 +0000 (21:40 +0000)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Thu, 4 Feb 2010 21:40:56 +0000 (21:40 +0000)
Lib/test/test_logging.py

index 25127c0d9b606b2757e83e78609f0b90f89ececf..9b410e9a7e18ff98dfec13ee23a9607d6ff3ee1c 100644 (file)
@@ -1355,6 +1355,36 @@ class ConfigDictTest(BaseTest):
         },
     }
 
+    #As config1 but using cfg:// references
+    config11 = {
+        'true_formatters': {
+            'form1' : {
+                'format' : '%(levelname)s ++ %(message)s',
+            },
+        },
+        'handler_configs': {
+            'hand1' : {
+                'class' : 'logging.StreamHandler',
+                'formatter' : 'form1',
+                'level' : 'NOTSET',
+                'stream'  : 'ext://sys.stdout',
+            },
+        },
+        'formatters' : 'cfg://true_formatters',
+        'handlers' : {
+            'hand1' : 'cfg://handler_configs[hand1]',
+        },
+        'loggers' : {
+            'compiler.parser' : {
+                'level' : 'DEBUG',
+                'handlers' : ['hand1'],
+            },
+        },
+        'root' : {
+            'level' : 'WARNING',
+        },
+    }
+
     def apply_config(self, conf):
         logging.config.dictConfig(conf)
 
@@ -1539,6 +1569,9 @@ class ConfigDictTest(BaseTest):
                 ('ERROR', '4'),
             ], stream=output)
 
+    def test_config11_ok(self):
+        self.test_config1_ok(self.config11)
+
     def setup_via_listener(self, text):
         PORT = 9030
         t = logging.config.listen(PORT)