Skip to content

Commit 3de1f3c

Browse files
committed
drop prospector in favour of flake8+black
due to unfixed dependency issues upstream: prospector-dev/prospector#413
1 parent 67a9755 commit 3de1f3c

File tree

7 files changed

+22
-17
lines changed

7 files changed

+22
-17
lines changed

setup.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ source =
1616
src
1717
.tox/*/site-packages
1818

19+
[flake8]
20+
max-line-length = 120
21+
max-complexity = 15
22+
ignore = E203,W503,W504
23+
1924
[isort]
2025
combine_as_imports=True
2126
force_grid_wrap=0

src/wsproto/handshake.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def events(self) -> Generator[Event, None, None]:
176176
while self._events:
177177
yield self._events.popleft()
178178

179-
############ Server mode methods
179+
# Server mode methods
180180

181181
def _process_connection_request( # noqa: MC0001
182182
self, event: h11.Request
@@ -317,7 +317,7 @@ def _send_reject_data(self, event: RejectData) -> bytes:
317317
self._state = ConnectionState.CLOSED
318318
return data
319319

320-
############ Client mode methods
320+
# Client mode methods
321321

322322
def _initiate_connection(self, request: Request) -> bytes:
323323
self._initiating_request = request

test/test_client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def test_connection_send_state() -> None:
130130
assert len(list(client.events())) == 1
131131
assert client.state is ConnectionState.OPEN # type: ignore # https://github.com/python/mypy/issues/9005
132132

133-
with pytest.raises(LocalProtocolError) as excinfo:
133+
with pytest.raises(LocalProtocolError):
134134
client.send(Request(host="localhost", target="/"))
135135

136136
client.receive_data(b"foobar")
@@ -202,20 +202,20 @@ def test_handshake_extra_accept_headers() -> None:
202202
@pytest.mark.parametrize("extra_headers", [[], [(b"connection", b"Keep-Alive")]])
203203
def test_handshake_response_broken_connection_header(extra_headers: Headers) -> None:
204204
with pytest.raises(RemoteProtocolError) as excinfo:
205-
events = _make_handshake(101, [(b"upgrade", b"WebSocket")] + extra_headers)
205+
_make_handshake(101, [(b"upgrade", b"WebSocket")] + extra_headers)
206206
assert str(excinfo.value) == "Missing header, 'Connection: Upgrade'"
207207

208208

209209
@pytest.mark.parametrize("extra_headers", [[], [(b"upgrade", b"h2")]])
210210
def test_handshake_response_broken_upgrade_header(extra_headers: Headers) -> None:
211211
with pytest.raises(RemoteProtocolError) as excinfo:
212-
events = _make_handshake(101, [(b"connection", b"Upgrade")] + extra_headers)
212+
_make_handshake(101, [(b"connection", b"Upgrade")] + extra_headers)
213213
assert str(excinfo.value) == "Missing header, 'Upgrade: WebSocket'"
214214

215215

216216
def test_handshake_response_missing_websocket_key_header() -> None:
217217
with pytest.raises(RemoteProtocolError) as excinfo:
218-
events = _make_handshake(
218+
_make_handshake(
219219
101,
220220
[(b"connection", b"Upgrade"), (b"upgrade", b"WebSocket")],
221221
auto_accept_key=False,
@@ -238,7 +238,7 @@ def test_handshake_with_subprotocol() -> None:
238238

239239
def test_handshake_bad_subprotocol() -> None:
240240
with pytest.raises(RemoteProtocolError) as excinfo:
241-
events = _make_handshake(
241+
_make_handshake(
242242
101,
243243
[
244244
(b"connection", b"Upgrade"),
@@ -265,7 +265,7 @@ def test_handshake_with_extension() -> None:
265265

266266
def test_handshake_bad_extension() -> None:
267267
with pytest.raises(RemoteProtocolError) as excinfo:
268-
events = _make_handshake(
268+
_make_handshake(
269269
101,
270270
[
271271
(b"connection", b"Upgrade"),

test/test_handshake.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pytest
22

33
from wsproto.connection import CLIENT, ConnectionState, SERVER
4-
from wsproto.events import AcceptConnection, Ping, RejectConnection, Request
4+
from wsproto.events import AcceptConnection, Ping, Request
55
from wsproto.handshake import H11Handshake
66
from wsproto.utilities import LocalProtocolError, RemoteProtocolError
77

test/test_permessage_deflate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def test_client_decompress_after_uncompressible_frame(self, client: bool) -> Non
304304
proto = fp.FrameProtocol(client=client, extensions=[ext])
305305

306306
# A PING frame
307-
result = ext.frame_inbound_header(
307+
ext.frame_inbound_header(
308308
proto, fp.Opcode.PING, fp.RsvBits(False, False, False), 0
309309
)
310310
result2 = ext.frame_inbound_payload_data(proto, b"")

test/test_server.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def test_connection_request() -> None:
6262

6363
def test_connection_request_bad_method() -> None:
6464
with pytest.raises(RemoteProtocolError) as excinfo:
65-
event = _make_connection_request(
65+
_make_connection_request(
6666
[
6767
(b"Host", b"localhost"),
6868
(b"Connection", b"Keep-Alive, Upgrade"),
@@ -77,7 +77,7 @@ def test_connection_request_bad_method() -> None:
7777

7878
def test_connection_request_bad_connection_header() -> None:
7979
with pytest.raises(RemoteProtocolError) as excinfo:
80-
event = _make_connection_request(
80+
_make_connection_request(
8181
[
8282
(b"Host", b"localhost"),
8383
(b"Connection", b"Keep-Alive, No-Upgrade"),
@@ -91,7 +91,7 @@ def test_connection_request_bad_connection_header() -> None:
9191

9292
def test_connection_request_bad_upgrade_header() -> None:
9393
with pytest.raises(RemoteProtocolError) as excinfo:
94-
event = _make_connection_request(
94+
_make_connection_request(
9595
[
9696
(b"Host", b"localhost"),
9797
(b"Connection", b"Keep-Alive, Upgrade"),
@@ -106,7 +106,7 @@ def test_connection_request_bad_upgrade_header() -> None:
106106
@pytest.mark.parametrize("version", [b"12", b"not-a-digit"])
107107
def test_connection_request_bad_version_header(version: bytes) -> None:
108108
with pytest.raises(RemoteProtocolError) as excinfo:
109-
event = _make_connection_request(
109+
_make_connection_request(
110110
[
111111
(b"Host", b"localhost"),
112112
(b"Connection", b"Keep-Alive, Upgrade"),
@@ -123,7 +123,7 @@ def test_connection_request_bad_version_header(version: bytes) -> None:
123123

124124
def test_connection_request_key_header() -> None:
125125
with pytest.raises(RemoteProtocolError) as excinfo:
126-
event = _make_connection_request(
126+
_make_connection_request(
127127
[
128128
(b"Host", b"localhost"),
129129
(b"Connection", b"Keep-Alive, Upgrade"),

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ commands = pytest {posargs}
2525

2626
[testenv:lint]
2727
deps =
28-
prospector==1.3.1
28+
flake8>=3.9.1,<4
2929
black==20.8b1
3030
isort==5.6.4
3131
mypy==0.790
3232
pytest==6.1.2
3333
commands =
34-
prospector
34+
flake8 src/ test/
3535
black --check --diff src/ test/ example/ compliance/ bench/
3636
isort --check --diff src/ test/ example/ compliance/ bench/
3737
mypy src/ test/ example/ bench/

0 commit comments

Comments
 (0)