diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2022-06-14 05:41:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-14 05:41:16 (GMT) |
commit | 5bcf33de0b6729bbd4ced442f69c55ff99ea4be0 (patch) | |
tree | 6433279e9cefcd2bed028ffe62d9164d0faea3af | |
parent | d7db9dc3cc5b44d0b4ce000571fecf58089a01ec (diff) | |
download | cpython-5bcf33de0b6729bbd4ced442f69c55ff99ea4be0.zip cpython-5bcf33de0b6729bbd4ced442f69c55ff99ea4be0.tar.gz cpython-5bcf33de0b6729bbd4ced442f69c55ff99ea4be0.tar.bz2 |
gh-93761: Fix test to avoid simple delay when synchronizing. (GH-93779)
-rw-r--r-- | Lib/test/test_logging.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 87b3efa..4954557 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -3609,13 +3609,15 @@ class ConfigDictTest(BaseTest): self.assertEqual(sorted(logging.getHandlerNames()), ['ah', 'h1']) self.assertIsNotNone(qh.listener) qh.listener.start() - # Need to let the listener thread get started - time.sleep(delay) logging.debug('foo') logging.info('bar') logging.warning('baz') # Need to let the listener thread finish its work - time.sleep(delay) + deadline = time.monotonic() + support.LONG_TIMEOUT + while not qh.listener.queue.empty(): + time.sleep(delay) + if time.monotonic() > deadline: + self.fail("queue not empty") with open(fn, encoding='utf-8') as f: data = f.read().splitlines() self.assertEqual(data, ['foo', 'bar', 'baz']) |