summaryrefslogtreecommitdiffhomepage
path: root/test/unit/http.py
diff options
context:
space:
mode:
authorAndrei Zeliankou <zelenkov@nginx.com>2024-01-15 15:48:58 +0000
committerAndrei Zeliankou <zelenkov@nginx.com>2024-01-15 15:48:58 +0000
commit5a8337933df1cf3aba967d86549e236dd9173386 (patch)
tree30842acf799fc521702b1c4b070332c72feaaa1c /test/unit/http.py
parente95a91cbfac018b9877d9e389e614e9f2a9f1313 (diff)
downloadunit-5a8337933df1cf3aba967d86549e236dd9173386.tar.gz
unit-5a8337933df1cf3aba967d86549e236dd9173386.tar.bz2
Tests: pathlib used where appropriate
Also fixed various pylint errors and style issues.
Diffstat (limited to 'test/unit/http.py')
-rw-r--r--test/unit/http.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/test/unit/http.py b/test/unit/http.py
index 5a6a1a1b..9401501b 100644
--- a/test/unit/http.py
+++ b/test/unit/http.py
@@ -7,6 +7,7 @@ import select
import socket
import pytest
+
from unit.option import option
@@ -38,10 +39,7 @@ class HTTP1:
if 'sock' not in kwargs:
sock = socket.socket(sock_types[sock_type], socket.SOCK_STREAM)
- if (
- sock_type == sock_types['ipv4']
- or sock_type == sock_types['ipv6']
- ):
+ if sock_type in (sock_types['ipv4'], sock_types['ipv6']):
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
if 'wrapper' in kwargs:
@@ -202,7 +200,7 @@ class HTTP1:
data += part
- if not len(part):
+ if not part:
break
return data
@@ -263,7 +261,7 @@ class HTTP1:
size = int(chunks.pop(0), 16)
except ValueError:
- pytest.fail(f'Invalid chunk size {size}')
+ pytest.fail('Invalid chunk size')
if size == 0:
assert len(chunks) == 1, 'last zero size'