summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_logging.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2017-10-19 01:02:59 (GMT)
committerƁukasz Langa <lukasz@langa.pl>2017-10-19 01:02:59 (GMT)
commit537ed75291ed8a640887f199f98e2e5076ef87b6 (patch)
tree2f09e5a252d038d93d4a241dcc549730284dbd9f /Lib/test/test_logging.py
parent7bbbc6afa4f500ffbd7bfc25dbabf85548421fff (diff)
downloadcpython-537ed75291ed8a640887f199f98e2e5076ef87b6.zip
cpython-537ed75291ed8a640887f199f98e2e5076ef87b6.tar.gz
cpython-537ed75291ed8a640887f199f98e2e5076ef87b6.tar.bz2
[3.6] bpo-31457: Make the `LoggerAdapter.manager` property settable (GH-4042) (#4043)
Due to a bug in the initial fix, the setter was in fact creating a different property. This is now fixed. (cherry picked from commit 0b6a118a45ac2eded1348fea6ed300d5651f7471)
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 25046c3..f0e2437 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -3959,12 +3959,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):