diff options
| author | Victor Stinner <vstinner@python.org> | 2019-12-10 20:41:23 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-12-10 20:41:23 +0100 |
| commit | bbc8b7965bb9f46763c96878326966f4231c7d39 (patch) | |
| tree | f9dfe1e3637a9c2805e8757a5abc75bdd0e47352 /Lib/test/test_logging.py | |
| parent | 07871b256c76ca561554d1f82b430fc64a5c7ee0 (diff) | |
| download | cpython-git-bbc8b7965bb9f46763c96878326966f4231c7d39.tar.gz | |
bpo-38614: Use default join_thread() timeout in tests (GH-17559)
Tests no longer pass a timeout value to join_thread() of
test.support: use the default join_thread() timeout instead
(SHORT_TIMEOUT constant of test.support).
Diffstat (limited to 'Lib/test/test_logging.py')
| -rw-r--r-- | Lib/test/test_logging.py | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index c47ad4ac75..3b135b8ddf 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -869,16 +869,13 @@ class TestSMTPServer(smtpd.SMTPServer): """ asyncore.loop(poll_interval, map=self._map) - def stop(self, timeout=None): + def stop(self): """ Stop the thread by closing the server instance. Wait for the server thread to terminate. - - :param timeout: How long to wait for the server thread - to terminate. """ self.close() - support.join_thread(self._thread, timeout) + support.join_thread(self._thread) self._thread = None asyncore.close_all(map=self._map, ignore_all=True) @@ -922,16 +919,13 @@ class ControlMixin(object): self.ready.set() super(ControlMixin, self).serve_forever(poll_interval) - def stop(self, timeout=None): + def stop(self): """ Tell the server thread to stop, and wait for it to do so. - - :param timeout: How long to wait for the server thread - to terminate. """ self.shutdown() if self._thread is not None: - support.join_thread(self._thread, timeout) + support.join_thread(self._thread) self._thread = None self.server_close() self.ready.clear() @@ -1699,7 +1693,7 @@ class SocketHandlerTest(BaseTest): self.root_logger.removeHandler(self.sock_hdlr) self.sock_hdlr.close() if self.server: - self.server.stop(2.0) + self.server.stop() finally: BaseTest.tearDown(self) @@ -1736,7 +1730,7 @@ class SocketHandlerTest(BaseTest): # one-second timeout on socket.create_connection() (issue #16264). self.sock_hdlr.retryStart = 2.5 # Kill the server - self.server.stop(2.0) + self.server.stop() # The logging call should try to connect, which should fail try: raise RuntimeError('Deliberate mistake') @@ -1810,7 +1804,7 @@ class DatagramHandlerTest(BaseTest): """Shutdown the UDP server.""" try: if self.server: - self.server.stop(2.0) + self.server.stop() if self.sock_hdlr: self.root_logger.removeHandler(self.sock_hdlr) self.sock_hdlr.close() @@ -1891,7 +1885,7 @@ class SysLogHandlerTest(BaseTest): """Shutdown the server.""" try: if self.server: - self.server.stop(2.0) + self.server.stop() if self.sl_hdlr: self.root_logger.removeHandler(self.sl_hdlr) self.sl_hdlr.close() @@ -2028,7 +2022,7 @@ class HTTPHandlerTest(BaseTest): self.assertEqual(d['funcName'], ['test_output']) self.assertEqual(d['msg'], [msg]) - self.server.stop(2.0) + self.server.stop() self.root_logger.removeHandler(self.h_hdlr) self.h_hdlr.close() @@ -3228,7 +3222,7 @@ class ConfigDictTest(BaseTest): finally: t.ready.wait(2.0) logging.config.stopListening() - support.join_thread(t, 2.0) + support.join_thread(t) def test_listen_config_10_ok(self): with support.captured_stdout() as output: |
