(self)
| 42 | self.assertIn("Connection refused", str(exc.inner)) |
| 43 | |
| 44 | def test_socket_readtimeout_exception(self): |
| 45 | acc = ServerAcceptor(TServerSocket(port=0)) |
| 46 | acc.start() |
| 47 | |
| 48 | sock = TSocket(host="localhost", port=acc.port) |
| 49 | sock.open() |
| 50 | sock.setTimeout(1) |
| 51 | sock.write(b"sleep") |
| 52 | |
| 53 | with self.assertRaises(TTransportException) as ctx: |
| 54 | sock.read(5) |
| 55 | exc = ctx.exception |
| 56 | self.assertEqual(exc.message, "read timeout") |
| 57 | |
| 58 | acc.client.close() # this also blocks until the other thread is done |
| 59 | acc.close() |
| 60 | sock.close() |
| 61 | |
| 62 | def test_isOpen_checks_for_readability(self): |
| 63 | # https://docs.python.org/3/library/socket.html#notes-on-socket-timeouts |
nothing calls this directly
no test coverage detected