From 2e8a17442b18de337ef7042765512b4c812a02c0 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Salgado Date: Tue, 16 Oct 2018 14:52:13 +0100 Subject: [PATCH] bpo-34997: Fix test_logging.ConfigDictTest.test_out_of_order When runnint test_logging with --huntrleaks, 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. --- Lib/test/test_logging.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 9802955e6a985b..c797d66aa6452c 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -25,6 +25,7 @@ import codecs import configparser +import copy import datetime import pathlib import pickle @@ -3278,7 +3279,7 @@ def test_out_of_order(self): self.assertRaises(ValueError, self.apply_config, self.out_of_order) 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}" self.apply_config(config)