diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-06-04 12:41:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-04 12:41:02 (GMT) |
commit | 0e150c36dee1734a6a60f1ebd924e90fb3fe1458 (patch) | |
tree | e4c3f0f4572ca6d6eab8b6f5ed06de9d6d01050a /Lib/test | |
parent | fe68908c54103f391daa22963b017843ec63d63e (diff) | |
download | cpython-0e150c36dee1734a6a60f1ebd924e90fb3fe1458.zip cpython-0e150c36dee1734a6a60f1ebd924e90fb3fe1458.tar.gz cpython-0e150c36dee1734a6a60f1ebd924e90fb3fe1458.tar.bz2 |
[3.12] gh-119819: Fix regression to allow logging configuration with multipr… (GH-120030) (GH-120034)
(cherry picked from commit 99d945c0c006e3246ac00338e37c443c6e08fc5c)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_logging.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index fa45503..d2a392b 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -3894,6 +3894,32 @@ class ConfigDictTest(BaseTest): msg = str(ctx.exception) self.assertEqual(msg, "Unable to configure handler 'ah'") + @unittest.skipIf(support.is_wasi, "WASI does not have multiprocessing.") + def test_multiprocessing_queues(self): + # See gh-119819 + cd = copy.deepcopy(self.config_queue_handler) + from multiprocessing import Queue as MQ, Manager as MM + q1 = MQ() # this can't be pickled + q2 = MM().Queue() # a proxy queue for use when pickling is needed + for qspec in (q1, q2): + fn = make_temp_file('.log', 'test_logging-cmpqh-') + cd['handlers']['h1']['filename'] = fn + cd['handlers']['ah']['queue'] = qspec + qh = None + try: + self.apply_config(cd) + qh = logging.getHandlerByName('ah') + self.assertEqual(sorted(logging.getHandlerNames()), ['ah', 'h1']) + self.assertIsNotNone(qh.listener) + self.assertIs(qh.queue, qspec) + self.assertIs(qh.listener.queue, qspec) + finally: + h = logging.getHandlerByName('h1') + if h: + self.addCleanup(closeFileHandler, h, fn) + else: + self.addCleanup(os.remove, fn) + def test_90195(self): # See gh-90195 config = { |