From dba3fa57e26c5b0f7a4bfd3228a9bc109f35b6c8 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sun, 19 Jun 2022 11:49:35 +0200 Subject: gh-93761: Fix test_logging test_config_queue_handler() race condition (#93952) Fix a race condition in test_config_queue_handler() of test_logging. --- Lib/test/test_logging.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 7859c60..0aec072 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -3603,6 +3603,9 @@ class ConfigDictTest(BaseTest): 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']) -- cgit v0.12