Commit f6e5494a authored by Denis Bilenko's avatar Denis Bilenko

test__socket.TestTCP.test_recv_timeout: check that connection was accepted

parent fd18f149
...@@ -44,6 +44,7 @@ class TestTCP(greentest.TestCase): ...@@ -44,6 +44,7 @@ class TestTCP(greentest.TestCase):
client_reader.get() client_reader.get()
def test_recv_timeout(self): def test_recv_timeout(self):
acceptor = gevent.spawn_link_exception(self.listener.accept)
client = self.create_connection() client = self.create_connection()
client.settimeout(0.1) client.settimeout(0.1)
start = time.time() start = time.time()
...@@ -53,6 +54,7 @@ class TestTCP(greentest.TestCase): ...@@ -53,6 +54,7 @@ class TestTCP(greentest.TestCase):
assert 0.1 - 0.01 <= time.time() - start <= 0.1 + 0.1, (time.time() - start) assert 0.1 - 0.01 <= time.time() - start <= 0.1 + 0.1, (time.time() - start)
else: else:
raise AssertionError('socket.timeout should have been raised, instead recv returned %r' % (data, )) raise AssertionError('socket.timeout should have been raised, instead recv returned %r' % (data, ))
acceptor.get()
def test_sendall_timeout(self): def test_sendall_timeout(self):
client = self.create_connection() client = self.create_connection()
......
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