Commit fa4b08ea authored by Jason Madden's avatar Jason Madden

Debuging the socket failure under travis.

parent 0611a4cc
......@@ -149,14 +149,25 @@ class TestTCP(greentest.TestCase):
def test_sendall_timeout(self):
data_sent = b'h' * 2000000
client_sock = []
acceptor = Thread(target=lambda: client_sock.append(self.listener.accept()))
def target():
print("Running thread")
sock = self.listener.accept()
print("Accepted")
client_sock.append(sock)
print("Done")
acceptor = Thread(target=target)
# acceptor = Thread(target=lambda: client_sock.append(self.listener.accept()))
client = self.create_connection()
time.sleep(0.1)
assert client_sock
client.settimeout(0.1)
start = time.time()
try:
self.assertRaises(self.TIMEOUT_ERROR, client.sendall, data_sent)
count = client.sendall(data_sent)
print("Sent data in %s" % (time.time() - start))
#self.assertRaises(self.TIMEOUT_ERROR, client.sendall, data_sent)
self.fail("Should raise timeout error")
except self.TIMEOUT_ERROR:
took = time.time() - start
assert 0.1 - 0.01 <= took <= 0.1 + 0.1, took
finally:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment