diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-06-27 09:09:17 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-27 09:09:17 (GMT) |
commit | 9df7392ebad877fdaa3d6f1c1f1c7504a50efb72 (patch) | |
tree | 9287073ab600672982d8d1b6c992be066ab6524c /Lib/test | |
parent | c83997476f9bcb28af02296c3c74c1549dcd9f35 (diff) | |
download | cpython-9df7392ebad877fdaa3d6f1c1f1c7504a50efb72.zip cpython-9df7392ebad877fdaa3d6f1c1f1c7504a50efb72.tar.gz cpython-9df7392ebad877fdaa3d6f1c1f1c7504a50efb72.tar.bz2 |
[3.13] gh-120868: Fix breaking change in `logging.config` when using `QueueHandler` (GH-120872) (GH-121078)
(cherry picked from commit 7d9c68513d112823a9a6cdc7453b998b2c24eb4c)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_logging.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index c78e76d..4223d10 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -3927,6 +3927,50 @@ class ConfigDictTest(BaseTest): msg = str(ctx.exception) self.assertEqual(msg, "Unable to configure handler 'ah'") + @threading_helper.requires_working_threading() + @support.requires_subprocess() + @patch("multiprocessing.Manager") + def test_config_queue_handler_does_not_create_multiprocessing_manager(self, manager): + # gh-120868 + + from multiprocessing import Queue as MQ + + q1 = {"()": "queue.Queue", "maxsize": -1} + q2 = MQ() + q3 = queue.Queue() + + for qspec in (q1, q2, q3): + self.apply_config( + { + "version": 1, + "handlers": { + "queue_listener": { + "class": "logging.handlers.QueueHandler", + "queue": qspec, + }, + }, + } + ) + manager.assert_not_called() + + @patch("multiprocessing.Manager") + def test_config_queue_handler_invalid_config_does_not_create_multiprocessing_manager(self, manager): + # gh-120868 + + with self.assertRaises(ValueError): + self.apply_config( + { + "version": 1, + "handlers": { + "queue_listener": { + "class": "logging.handlers.QueueHandler", + "queue": object(), + }, + }, + } + ) + manager.assert_not_called() + @support.requires_subprocess() def test_multiprocessing_queues(self): # See gh-119819 |