Commit 72190163 authored by Jason Madden's avatar Jason Madden

Remove test__socket debugging. It does seem that TravisCI uses large buffers by default.

parent 70c61625
......@@ -291,17 +291,14 @@ class socket(object):
data_sent = 0
while data_sent < len(data):
data_sent += self.send(_get_memory(data, data_sent), flags)
return data_sent, 'no timeout'
else:
timeleft = self.timeout
end = time.time() + timeleft
data_sent = 0
trips = 0
while True:
trips += 1
data_sent += self.send(_get_memory(data, data_sent), flags, timeout=timeleft)
if data_sent >= len(data):
return data_sent, 'timeout', self.timeout, trips
return
timeleft = end - time.time()
if timeleft <= 0:
raise timeout('timed out')
......
......@@ -147,6 +147,9 @@ class TestTCP(greentest.TestCase):
if sys.platform != 'win32':
def test_sendall_timeout(self):
# Travis-CI container infrastructure is configured with
# large socket buffers, at least 2MB, as-of Jun 3, 2015,
# so we must be sure to send more data than that.
data_sent = b'hello' * 1000000
client_sock = []
acceptor = Thread(target=lambda: client_sock.append(self.listener.accept()))
......@@ -156,11 +159,7 @@ class TestTCP(greentest.TestCase):
client.settimeout(0.1)
start = time.time()
try:
count = client.sendall(data_sent)
print("Sent %s data in %s" % (count, time.time() - start))
#self.assertRaises(self.TIMEOUT_ERROR, client.sendall, data_sent)
self.fail("Should raise timeout error")
except self.TIMEOUT_ERROR:
self.assertRaises(self.TIMEOUT_ERROR, client.sendall, data_sent)
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