Skip to content

Commit 6c23d82

Browse files
authored
Switch from pytest-flake8 to raw flake8; clean up ignores (#182)
1 parent 97ac45b commit 6c23d82

File tree

5 files changed

+25
-24
lines changed

5 files changed

+25
-24
lines changed

.flake8

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[flake8]
2+
ignore =
3+
# Refers to the max-line length. Let's suppress the error and simply
4+
# let black take care on how it wants to format the lines.
5+
E501,
6+
7+
# Refers to "line break before/after binary operator".
8+
# Similar to above, let black take care of the formatting.
9+
W503,
10+
W504,
11+
12+
# black disagrees with flake8, and inserts whitespace
13+
E203, # whitespace before ':'

pytest.ini

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,2 @@
11
[pytest]
22
doctest_optionflags = ALLOW_UNICODE ALLOW_BYTES
3-
flake8-max-line-length = 88
4-
flake8-ignore =
5-
W503 # https://www.flake8rules.com/rules/W503.html
6-
E203 # https://www.flake8rules.com/rules/E203.html
7-
8-
docs/conf.py E121 E122 E265 E401
9-
tests/test_encoding.py E128 E221 E241 E302 E401 E501 E731
10-
tests/test_form.py E265
11-
tests/test_html.py E123 E128 E241 E303 E501 E502
12-
tests/test_http.py E128 E261 E302 W291
13-
tests/test_url.py E126 E127 E128 E226 E261 E303 E501 W293 W391
14-
w3lib/encoding.py E126 E128 E302 E305 E401 E501
15-
w3lib/form.py E402 E501 E721
16-
w3lib/html.py E128 E302 E501 E502 W504
17-
w3lib/http.py E501
18-
w3lib/url.py E128 E261 E302 E305 E501 F841 W291 W293 W504
19-
w3lib/util.py E302

tests/test_encoding.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,9 @@ def test_html_encoding(self):
280280
self._assert_encoding_detected(None, "utf-8", codecs.BOM_UTF8 + body)
281281

282282
def test_autodetect(self):
283-
asciif = lambda x: "ascii"
283+
def asciif(x):
284+
return "ascii"
285+
284286
body = b"""<meta charset="utf-8">"""
285287
# body encoding takes precedence
286288
self._assert_encoding_detected(None, "utf-8", body, auto_detect_fun=asciif)

tox.ini

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ basepython = python3
2727
deps =
2828
# mypy would error if pytest (or its sub) not found
2929
pytest
30-
mypy==0.910
30+
mypy==0.971
3131
commands =
3232
mypy --show-error-codes {posargs: w3lib tests}
3333

3434
[testenv:flake8]
3535
basepython = python3
3636
deps =
37-
{[testenv]deps}
38-
pytest-flake8
37+
flake8
3938
commands =
40-
pytest --flake8
39+
flake8 \
40+
{posargs:w3lib tests setup.py}
4141

4242
[testenv:pylint]
4343
deps =
@@ -48,7 +48,7 @@ commands =
4848

4949
[testenv:black]
5050
deps =
51-
black==22.3.0
51+
black==22.6.0
5252
commands =
5353
black --check {posargs:conftest.py setup.py tests w3lib}
5454

w3lib/encoding.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
"""
22
Functions for handling encoding of web pages
33
"""
4-
import re, codecs, encodings
4+
import re
5+
import codecs
6+
import encodings
57
from typing import Callable, Match, Optional, Tuple, Union, cast
8+
69
from w3lib._types import AnyUnicodeError, StrOrBytes
710
import w3lib.util
811

0 commit comments

Comments
 (0)