summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_logging.py
diff options
context:
space:
mode:
authorƁukasz Langa <lukasz@langa.pl>2017-10-19 00:28:51 (GMT)
committerGitHub <noreply@github.com>2017-10-19 00:28:51 (GMT)
commit0b6a118a45ac2eded1348fea6ed300d5651f7471 (patch)
treec4669de7f6be919053a564411ff6b8f559eb1fa9 /Lib/test/test_logging.py
parent032a6480e360427d4f964e31643604fad804ea14 (diff)
downloadcpython-0b6a118a45ac2eded1348fea6ed300d5651f7471.zip
cpython-0b6a118a45ac2eded1348fea6ed300d5651f7471.tar.gz
cpython-0b6a118a45ac2eded1348fea6ed300d5651f7471.tar.bz2
bpo-31457: Make the `LoggerAdapter.manager` property settable (#4042)
Due to a bug in the initial fix, the setter was in fact creating a different property. This is now fixed.
Diffstat (limited to 'Lib/test/test_logging.py')
-rw-r--r--Lib/test/test_logging.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index fb0de9d..583394c 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -3982,12 +3982,25 @@ class LoggerAdapterTest(unittest.TestCase):
msg = 'Adapters can be nested, yo.'
adapter_adapter = logging.LoggerAdapter(logger=self.adapter, extra=None)
adapter_adapter.log(logging.CRITICAL, msg, self.recording)
-
self.assertEqual(len(self.recording.records), 1)
record = self.recording.records[0]
self.assertEqual(record.levelno, logging.CRITICAL)
self.assertEqual(record.msg, msg)
self.assertEqual(record.args, (self.recording,))
+ orig_manager = adapter_adapter.manager
+ self.assertIs(self.adapter.manager, orig_manager)
+ self.assertIs(self.logger.manager, orig_manager)
+ temp_manager = object()
+ try:
+ adapter_adapter.manager = temp_manager
+ self.assertIs(adapter_adapter.manager, temp_manager)
+ self.assertIs(self.adapter.manager, temp_manager)
+ self.assertIs(self.logger.manager, temp_manager)
+ finally:
+ adapter_adapter.manager = orig_manager
+ self.assertIs(adapter_adapter.manager, orig_manager)
+ self.assertIs(self.adapter.manager, orig_manager)
+ self.assertIs(self.logger.manager, orig_manager)
class LoggerTest(BaseTest):