summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJakub Stasiak <jakub@stasiak.at>2016-01-10 04:01:36 +0100
committerJakub Stasiak <jakub@stasiak.at>2016-01-10 04:01:36 +0100
commitb2fb240978654950005636442ca20107a96118ec (patch)
tree6b724c5263cd4074d6bdcf744d6a1457f6a2eb30 /tests
parentff2479fd966811519e4c2e5e4e908bbd326fbaf1 (diff)
downloadeventlet-b2fb240978654950005636442ca20107a96118ec.tar.gz
tests: Make the test_closure test less CPU intensive
As far as I can see the test already had a tendency to timeout and [1] pushed it over the threshold of 1 second on Travis (Python 2 builds). I don't see a point of flooding the socket like this so adding an artifical delay seems like an easy "fix" here. From what I understand the logic of the test (introduced in [2]) remains unchanged - a closer greenthread closes the client socket, client greenthread finishes because of EBADF and server greenthread finishes because of broken pipe. [1] bc4d1b5d362e5baaeded35b1e339b9db08172dd2 [2] 1a8a9fc0512299c8fe944784525a021dbd2fe2a0
Diffstat (limited to 'tests')
-rw-r--r--tests/greenio_test.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/greenio_test.py b/tests/greenio_test.py
index 5eaf6b5..9a2699a 100644
--- a/tests/greenio_test.py
+++ b/tests/greenio_test.py
@@ -481,6 +481,9 @@ class TestGreenSocket(tests.LimitedTestCase):
while True:
try:
sock.sendall(b'hello world')
+ # Arbitrary delay to not use all available CPU, keeps the test
+ # running quickly and reliably under a second
+ time.sleep(0.001)
except socket.error as e:
if get_errno(e) == errno.EPIPE:
return
@@ -496,6 +499,9 @@ class TestGreenSocket(tests.LimitedTestCase):
while True:
data = client.recv(1024)
assert data
+ # Arbitrary delay to not use all available CPU, keeps the test
+ # running quickly and reliably under a second
+ time.sleep(0.001)
except socket.error as e:
# we get an EBADF because client is closed in the same process
# (but a different greenthread)