mirror of https://github.com/python/cpython.git
Added unit test for cfg:// resolution.
This commit is contained in:
parent
0e6e97d9ad
commit
f7610b23de
|
@ -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):
|
def apply_config(self, conf):
|
||||||
logging.config.dictConfig(conf)
|
logging.config.dictConfig(conf)
|
||||||
|
|
||||||
|
@ -1539,6 +1569,9 @@ def test_config_10_ok(self):
|
||||||
('ERROR', '4'),
|
('ERROR', '4'),
|
||||||
], stream=output)
|
], stream=output)
|
||||||
|
|
||||||
|
def test_config11_ok(self):
|
||||||
|
self.test_config1_ok(self.config11)
|
||||||
|
|
||||||
def setup_via_listener(self, text):
|
def setup_via_listener(self, text):
|
||||||
PORT = 9030
|
PORT = 9030
|
||||||
t = logging.config.listen(PORT)
|
t = logging.config.listen(PORT)
|
||||||
|
|
Loading…
Reference in New Issue