Skip to content

Commit 4909d56

Browse files
authored
Merge pull request #148 from Gallaecio/flake8
Add pytest-flake8
2 parents ba4454e + 493bbcf commit 4909d56

File tree

4 files changed

+33
-0
lines changed

4 files changed

+33
-0
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ matrix:
44
include:
55
- python: 3.8
66
env: TOXENV=security
7+
- python: 3.8
8+
env: TOXENV=flake8
79
- python: 2.7
810
env: TOXENV=py27
911
- python: pypy

conftest.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
11
collect_ignore = ["setup.py"]
2+
3+
4+
def pytest_collection_modifyitems(session, config, items):
5+
# Avoid executing tests when executing `--flake8` flag (pytest-flake8)
6+
try:
7+
from pytest_flake8 import Flake8Item
8+
if config.getoption('--flake8'):
9+
items[:] = [item for item in items if isinstance(item, Flake8Item)]
10+
except ImportError:
11+
pass

pytest.ini

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

tox.ini

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ deps =
2222
commands =
2323
bandit -r -c .bandit.yml {posargs:w3lib}
2424

25+
[testenv:flake8]
26+
basepython = python3
27+
deps =
28+
{[testenv]deps}
29+
pytest-flake8
30+
commands =
31+
pytest --flake8
32+
2533
[docs]
2634
changedir = docs
2735
deps = -rdocs/requirements.txt

0 commit comments

Comments
 (0)