summaryrefslogtreecommitdiffhomepage
path: root/test/unit.py
diff options
context:
space:
mode:
authorAndrey Zelenkov <zelenkov@nginx.com>2018-07-13 20:15:50 +0300
committerAndrey Zelenkov <zelenkov@nginx.com>2018-07-13 20:15:50 +0300
commitcfe91315eb6a9473db532800d9a18576536c8ee0 (patch)
treeaebd1e0bdafac4b85c994ce2e857874ce18c5613 /test/unit.py
parent92a7d9f0c6d0a6055115a6d2ec5c198c32639c76 (diff)
downloadunit-cfe91315eb6a9473db532800d9a18576536c8ee0.tar.gz
unit-cfe91315eb6a9473db532800d9a18576536c8ee0.tar.bz2
Tests: HTTP settings.
Diffstat (limited to '')
-rw-r--r--test/unit.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/unit.py b/test/unit.py
index f9716366..c8820280 100644
--- a/test/unit.py
+++ b/test/unit.py
@@ -250,7 +250,7 @@ class TestUnitHTTP(TestUnit):
if '--verbose' in sys.argv:
print('>>>', req, sep='\n')
- resp = self._recvall(sock)
+ resp = self.recvall(sock)
if '--verbose' in sys.argv:
print('<<<', resp.encode('utf-8'), sep='\n')
@@ -276,11 +276,16 @@ class TestUnitHTTP(TestUnit):
def put(self, **kwargs):
return self.http('PUT', **kwargs)
- def _recvall(self, sock, buff_size=4096):
+ def recvall(self, sock, buff_size=4096):
data = b''
while select.select([sock], [], [], 1)[0]:
- part = sock.recv(buff_size)
+ try:
+ part = sock.recv(buff_size)
+ except:
+ break
+
data += part
+
if not len(part):
break