diff options
Diffstat (limited to 'Lib/test/test_logging.py')
| -rw-r--r-- | Lib/test/test_logging.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 4954557..d43742e 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -3602,7 +3602,6 @@ class ConfigDictTest(BaseTest): if lspec is not None: cd['handlers']['ah']['listener'] = lspec qh = None - delay = 0.01 try: self.apply_config(cd) qh = logging.getHandlerByName('ah') @@ -3612,12 +3611,14 @@ class ConfigDictTest(BaseTest): logging.debug('foo') logging.info('bar') logging.warning('baz') + # Need to let the listener thread finish its work - deadline = time.monotonic() + support.LONG_TIMEOUT - while not qh.listener.queue.empty(): - time.sleep(delay) - if time.monotonic() > deadline: - self.fail("queue not empty") + while support.sleeping_retry(support.LONG_TIMEOUT, error=False): + if qh.listener.queue.empty(): + break + else: + self.fail("queue not empty") + with open(fn, encoding='utf-8') as f: data = f.read().splitlines() self.assertEqual(data, ['foo', 'bar', 'baz']) |
