Skip to content

Commit

Permalink
gh-93761: Fix test to avoid simple delay when synchronizing.
Browse files Browse the repository at this point in the history
  • Loading branch information
vsajip committed Jun 13, 2022
1 parent 3ceb4b8 commit 6e5b7cb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Lib/test/test_logging.py
Expand Up @@ -3609,13 +3609,15 @@ def do_queuehandler_configuration(self, qspec, lspec):
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'])
Expand Down

0 comments on commit 6e5b7cb

Please sign in to comment.