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'])