mirror of
https://github.com/python/cpython.git
synced 2025-12-04 16:43:27 +00:00
bpo-34997: Fix test_logging.ConfigDictTest.test_out_of_order (GH-9913)
When runnint test_logging with --huntrleaks after commit
18fb1fb943, test_out_of_order fails
to raise ValueError due to the fact that the new test
test_out_of_order_with_dollar_style mutates the out_of_order
dictionary. Even if the test copies the dictionary first, the mutation
is done in a very deep level so the original one is also affected.
This commit is contained in:
parent
1a4a10d9f1
commit
137b0632dc
1 changed files with 2 additions and 1 deletions
|
|
@ -25,6 +25,7 @@ import logging.config
|
||||||
|
|
||||||
import codecs
|
import codecs
|
||||||
import configparser
|
import configparser
|
||||||
|
import copy
|
||||||
import datetime
|
import datetime
|
||||||
import pathlib
|
import pathlib
|
||||||
import pickle
|
import pickle
|
||||||
|
|
@ -3278,7 +3279,7 @@ class ConfigDictTest(BaseTest):
|
||||||
self.assertRaises(ValueError, self.apply_config, self.out_of_order)
|
self.assertRaises(ValueError, self.apply_config, self.out_of_order)
|
||||||
|
|
||||||
def test_out_of_order_with_dollar_style(self):
|
def test_out_of_order_with_dollar_style(self):
|
||||||
config = self.out_of_order.copy()
|
config = copy.deepcopy(self.out_of_order)
|
||||||
config['formatters']['mySimpleFormatter']['format'] = "${asctime} (${name}) ${levelname}: ${message}"
|
config['formatters']['mySimpleFormatter']['format'] = "${asctime} (${name}) ${levelname}: ${message}"
|
||||||
|
|
||||||
self.apply_config(config)
|
self.apply_config(config)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue