@@ -2389,6 +2389,32 @@ class ConfigDictTest(BaseTest):
23892389 },
23902390 }
23912391
2392+ # As config0, but with properties
2393+ config14 = {
2394+ 'version' : 1 ,
2395+ 'formatters' : {
2396+ 'form1' : {
2397+ 'format' : '%(levelname)s ++ %(message)s' ,
2398+ },
2399+ },
2400+ 'handlers' : {
2401+ 'hand1' : {
2402+ 'class' : 'logging.StreamHandler' ,
2403+ 'formatter' : 'form1' ,
2404+ 'level' : 'NOTSET' ,
2405+ 'stream' : 'ext://sys.stdout' ,
2406+ '.' : {
2407+ 'foo' : 'bar' ,
2408+ 'terminator' : '!\n ' ,
2409+ }
2410+ },
2411+ },
2412+ 'root' : {
2413+ 'level' : 'WARNING' ,
2414+ 'handlers' : ['hand1' ],
2415+ },
2416+ }
2417+
23922418 def apply_config (self , conf ):
23932419 logging .config .dictConfig (conf )
23942420
@@ -2625,6 +2651,15 @@ def test_config12_failure(self):
26252651 def test_config13_failure (self ):
26262652 self .assertRaises (Exception , self .apply_config , self .config13 )
26272653
2654+ def test_config14_ok (self ):
2655+ with captured_stdout () as output :
2656+ self .apply_config (self .config14 )
2657+ h = logging ._handlers ['hand1' ]
2658+ self .assertEqual (h .foo , 'bar' )
2659+ self .assertEqual (h .terminator , '!\n ' )
2660+ logging .warning ('Exclamation' )
2661+ self .assertTrue (output .getvalue ().endswith ('Exclamation!\n ' ))
2662+
26282663 @unittest .skipUnless (threading , 'listen() needs threading to work' )
26292664 def setup_via_listener (self , text , verify = None ):
26302665 text = text .encode ("utf-8" )
0 commit comments