mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
bpo-38586: setting logging.Handler .name property in fileConfig (GH-16918)
This commit is contained in:
parent
79d4ed102a
commit
b15100fe7d
3 changed files with 26 additions and 0 deletions
|
@ -1591,6 +1591,30 @@ class ConfigFileTest(BaseTest):
|
|||
self.apply_config(self.disable_test, disable_existing_loggers=False)
|
||||
self.assertFalse(logger.disabled)
|
||||
|
||||
def test_config_set_handler_names(self):
|
||||
test_config = """
|
||||
[loggers]
|
||||
keys=root
|
||||
|
||||
[handlers]
|
||||
keys=hand1
|
||||
|
||||
[formatters]
|
||||
keys=form1
|
||||
|
||||
[logger_root]
|
||||
handlers=hand1
|
||||
|
||||
[handler_hand1]
|
||||
class=StreamHandler
|
||||
formatter=form1
|
||||
|
||||
[formatter_form1]
|
||||
format=%(levelname)s ++ %(message)s
|
||||
"""
|
||||
self.apply_config(test_config)
|
||||
self.assertEquals(logging.getLogger().handlers[0].name, 'hand1')
|
||||
|
||||
def test_defaults_do_no_interpolation(self):
|
||||
"""bpo-33802 defaults should not get interpolated"""
|
||||
ini = textwrap.dedent("""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue