From 144abf2a7ff7f64f69664d795cd3a475f6f0f736 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 17 Jun 2022 17:22:45 +0200 Subject: [PATCH] gh-93761: Fix test_logging test_config_queue_handler() race condition 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 7859c604f0ef58..0aec0728c0a8a0 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'])