diff --git a/irctest/cases.py b/irctest/cases.py index 61051c6..cd7deca 100644 --- a/irctest/cases.py +++ b/irctest/cases.py @@ -113,7 +113,11 @@ class BaseClientTestCase(_IrcTestCase): self._setUpServer() def tearDown(self): if self.conn: - self.conn.sendall(b'QUIT :end of test.') + try: + self.conn.sendall(b'QUIT :end of test.') + except BrokenPipeError: + # client already disconnected + pass self.controller.kill() if self.conn: self.conn_file.close() diff --git a/irctest/client_tests/test_tls.py b/irctest/client_tests/test_tls.py index 737fa2e..5b47362 100644 --- a/irctest/client_tests/test_tls.py +++ b/irctest/client_tests/test_tls.py @@ -139,5 +139,5 @@ class TlsTestCase(cases.BaseClientTestCase): tls_config=tls_config, ) self.acceptClient(tls_cert=BAD_CERT, tls_key=BAD_KEY) - with self.assertRaises(ConnectionClosed): + with self.assertRaises((ConnectionClosed, ConnectionResetError)): m = self.getMessage()