]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-93761: Fix test_logging test_config_queue_handler() race condition (#93952)
authorVictor Stinner <vstinner@python.org>
Sun, 19 Jun 2022 09:49:35 +0000 (11:49 +0200)
committerGitHub <noreply@github.com>
Sun, 19 Jun 2022 09:49:35 +0000 (11:49 +0200)
Fix a race condition in test_config_queue_handler() of test_logging.

Lib/test/test_logging.py

index 7859c604f0ef58ca5ef6c66288ba4b92d8036caf..0aec0728c0a8a0604301824ae1a02638b615d5fb 100644 (file)
@@ -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'])