summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_logging.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-09-14 21:40:56 (GMT)
committerGitHub <noreply@github.com>2017-09-14 21:40:56 (GMT)
commitb9b69003d91c6ea94b890ce24ed25686d30f1428 (patch)
tree51ff0c32353a7f82e02879bd7b8efd36ffc17ca9 /Lib/test/test_logging.py
parent167cbde50a88ec2a7d26b2cb9891d5e32bdfbfb5 (diff)
downloadcpython-b9b69003d91c6ea94b890ce24ed25686d30f1428.zip
cpython-b9b69003d91c6ea94b890ce24ed25686d30f1428.tar.gz
cpython-b9b69003d91c6ea94b890ce24ed25686d30f1428.tar.bz2
bpo-31234: Add support.join_thread() helper (#3587)
join_thread() joins a thread but raises an AssertionError if the thread is still alive after timeout seconds.
Diffstat (limited to 'Lib/test/test_logging.py')
-rw-r--r--Lib/test/test_logging.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 611044d..d264d78 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -791,13 +791,10 @@ class TestSMTPServer(smtpd.SMTPServer):
to terminate.
"""
self.close()
- self._thread.join(timeout)
+ support.join_thread(self._thread, timeout)
+ self._thread = None
asyncore.close_all(map=self._map, ignore_all=True)
- alive = self._thread.is_alive()
- self._thread = None
- if alive:
- self.fail("join() timed out")
class ControlMixin(object):
"""
@@ -847,11 +844,8 @@ class ControlMixin(object):
"""
self.shutdown()
if self._thread is not None:
- self._thread.join(timeout)
- alive = self._thread.is_alive()
+ support.join_thread(self._thread, timeout)
self._thread = None
- if alive:
- self.fail("join() timed out")
self.server_close()
self.ready.clear()
@@ -2892,9 +2886,7 @@ class ConfigDictTest(BaseTest):
finally:
t.ready.wait(2.0)
logging.config.stopListening()
- t.join(2.0)
- if t.is_alive():
- self.fail("join() timed out")
+ support.join_thread(t, 2.0)
def test_listen_config_10_ok(self):
with support.captured_stdout() as output: