[Python-checkins] gh-93761: Fix test_logging test_config_queue_handler() race condition (#93952)

vstinner webhook-mailer at python.org
Sun Jun 19 05:50:05 EDT 2022


https://github.com/python/cpython/commit/dba3fa57e26c5b0f7a4bfd3228a9bc109f35b6c8
commit: dba3fa57e26c5b0f7a4bfd3228a9bc109f35b6c8
branch: main
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2022-06-19T11:49:35+02:00
summary:

gh-93761: Fix test_logging test_config_queue_handler() race condition (#93952)

Fix a race condition in test_config_queue_handler() of test_logging.

files:
M Lib/test/test_logging.py

diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 7859c604f0ef5..0aec0728c0a8a 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -3603,6 +3603,9 @@ def do_queuehandler_configuration(self, qspec, lspec):
                 if qh.listener.queue.empty():
                     break
 
+            # wait until the handler completed its last task
+            qh.listener.queue.join()
+
             with open(fn, encoding='utf-8') as f:
                 data = f.read().splitlines()
             self.assertEqual(data, ['foo', 'bar', 'baz'])



More information about the Python-checkins mailing list