mirror of
https://github.com/python/cpython.git
synced 2025-10-14 10:53:40 +00:00
gh-93761: Fix test to avoid simple delay when synchronizing. (GH-93779)
This commit is contained in:
parent
d7db9dc3cc
commit
5bcf33de0b
1 changed files with 5 additions and 3 deletions
|
@ -3609,13 +3609,15 @@ class ConfigDictTest(BaseTest):
|
||||||
self.assertEqual(sorted(logging.getHandlerNames()), ['ah', 'h1'])
|
self.assertEqual(sorted(logging.getHandlerNames()), ['ah', 'h1'])
|
||||||
self.assertIsNotNone(qh.listener)
|
self.assertIsNotNone(qh.listener)
|
||||||
qh.listener.start()
|
qh.listener.start()
|
||||||
# Need to let the listener thread get started
|
|
||||||
time.sleep(delay)
|
|
||||||
logging.debug('foo')
|
logging.debug('foo')
|
||||||
logging.info('bar')
|
logging.info('bar')
|
||||||
logging.warning('baz')
|
logging.warning('baz')
|
||||||
# Need to let the listener thread finish its work
|
# Need to let the listener thread finish its work
|
||||||
|
deadline = time.monotonic() + support.LONG_TIMEOUT
|
||||||
|
while not qh.listener.queue.empty():
|
||||||
time.sleep(delay)
|
time.sleep(delay)
|
||||||
|
if time.monotonic() > deadline:
|
||||||
|
self.fail("queue not empty")
|
||||||
with open(fn, encoding='utf-8') as f:
|
with open(fn, encoding='utf-8') as f:
|
||||||
data = f.read().splitlines()
|
data = f.read().splitlines()
|
||||||
self.assertEqual(data, ['foo', 'bar', 'baz'])
|
self.assertEqual(data, ['foo', 'bar', 'baz'])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue