MCPcopy Create free account
hub / github.com/apache/thrift / test_socket_readtimeout_exception

Method test_socket_readtimeout_exception

lib/py/test/test_socket.py:44–60  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 11

openMethod · 0.95
setTimeoutMethod · 0.95
writeMethod · 0.95
readMethod · 0.95
closeMethod · 0.95
closeMethod · 0.95
ServerAcceptorClass · 0.90
TServerSocketClass · 0.90
TSocketClass · 0.90
closeMethod · 0.65
startMethod · 0.45

Tested by

no test coverage detected