summaryrefslogtreecommitdiffhomepage
path: root/test/unit.py
diff options
context:
space:
mode:
authorAndrey Zelenkov <zelenkov@nginx.com>2018-02-20 20:34:46 +0300
committerAndrey Zelenkov <zelenkov@nginx.com>2018-02-20 20:34:46 +0300
commit6d79c559b5cebeb2ad7c5dbdb779e3bec26fc08a (patch)
tree75bc6400a3b0cc53ee4b933367291cac0a0ebeff /test/unit.py
parent09f2009df564ab2063ee4713ba24247039945146 (diff)
downloadunit-6d79c559b5cebeb2ad7c5dbdb779e3bec26fc08a.tar.gz
unit-6d79c559b5cebeb2ad7c5dbdb779e3bec26fc08a.tar.bz2
Tests: handle ConnectionRefusedError in TestUnitHTTP.http().
Diffstat (limited to 'test/unit.py')
-rw-r--r--test/unit.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/unit.py b/test/unit.py
index 2d50d64b..48b5497d 100644
--- a/test/unit.py
+++ b/test/unit.py
@@ -154,10 +154,12 @@ class TestUnitHTTP(TestUnit):
if 'sock' not in kwargs:
sock = socket.socket(sock_types[sock_type], socket.SOCK_STREAM)
- if sock_type == 'unix':
- sock.connect(addr)
- else:
- sock.connect((addr, port))
+ connect_args = addr if sock_type == 'unix' else (addr, port)
+ try:
+ sock.connect(connect_args)
+ except ConnectionRefusedError:
+ sock.close()
+ return None
else:
sock = kwargs['sock']