From 5c77587c3336c6f40c6018518657884209010405 Mon Sep 17 00:00:00 2001 From: cclauss Date: Mon, 2 Apr 2018 07:26:22 +0200 Subject: [PATCH 1/2] Run flake8 instead of pep8 on Python 3.6 As discussed at https://github.com/matplotlib/matplotlib/pull/10938#issuecomment-377855594 _undefined names_ have [occurred often in the past](https://github.com/matplotlib/matplotlib/pulls?q=is%3Apr+author%3Acclauss+is%3Aclosed) and this change would help to avoid recurrence in the future. --- .travis.yml | 8 ++++---- pytest.ini | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 77029736b75d..6d26a6170271 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,7 +57,7 @@ env: - PYPARSING=pyparsing - PYTEST='pytest>=3.4' - PYTEST_COV=pytest-cov - - PYTEST_PEP8= + - PYTEST_FLAKE8= - SPHINX=sphinx # Variables controlling the test run. - DELETE_FONT_CACHE= @@ -65,9 +65,9 @@ env: - NPROC=2 - OPENBLAS_NUM_THREADS=1 - PYTHONFAULTHANDLER=1 + - RUN_FLAKE8= - PYTEST_ARGS="-rawR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n $NPROC" - PYTHON_ARGS= - - RUN_PEP8= matrix: include: @@ -86,7 +86,7 @@ matrix: - python: 3.5 env: PYTHON_ARGS=-OO - python: 3.6 - env: DELETE_FONT_CACHE=1 PANDAS='pandas<0.21.0' PYTEST_PEP8=pytest-pep8 RUN_PEP8=--pep8 + env: DELETE_FONT_CACHE=1 PANDAS='pandas<0.21.0' PYTEST_FLAKE8=pytest-flake8 RUN_FLAKE8=--flake8 - python: "nightly" env: PRE=--pre - os: osx @@ -171,7 +171,7 @@ install: $PYTEST \ $PYTEST_COV \ pytest-faulthandler \ - $PYTEST_PEP8 \ + $PYTEST_FLAKE8 \ pytest-rerunfailures \ pytest-timeout \ pytest-xdist diff --git a/pytest.ini b/pytest.ini index c3b723fe29c8..b0b9fe45ac72 100644 --- a/pytest.ini +++ b/pytest.ini @@ -7,8 +7,9 @@ markers = network: Mark a test that uses the network. style: Set alternate Matplotlib style temporarily. -pep8ignore = - * E111 E114 E115 E116 E121 E122 E123 E124 E125 E126 E127 E128 E129 E131 E226 E240 E241 E242 E243 E244 E245 E246 E247 E248 E249 E265 E266 E704 W503 +flake8-max-line-length = 80 +flake8-ignore = + *.py E114 E116 E122 E127 E128 E129 E131 E202 E203 E225 E261 E265 E305 E722 E741 F401 F403 F811 F841 tools/boilerplate.py E501 setup.py E402 From 369da090dddba38d5df29e397a8f775957a106e3 Mon Sep 17 00:00:00 2001 From: cclauss Date: Tue, 8 May 2018 10:46:41 +0200 Subject: [PATCH 2/2] Restore per-file exceptions, fix test_script.sh --- .travis.yml | 2 +- ci/travis/test_script.sh | 4 ++-- pytest.ini | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6d26a6170271..b9ff97434fcf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -66,7 +66,7 @@ env: - OPENBLAS_NUM_THREADS=1 - PYTHONFAULTHANDLER=1 - RUN_FLAKE8= - - PYTEST_ARGS="-rawR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n $NPROC" + - PYTEST_ARGS="-rawR --maxfail=50 --timeout=350 --durations=25 --cov-report= --cov=lib -n $NPROC" - PYTHON_ARGS= matrix: diff --git a/ci/travis/test_script.sh b/ci/travis/test_script.sh index f6446d21f16d..3dda55db9ff2 100755 --- a/ci/travis/test_script.sh +++ b/ci/travis/test_script.sh @@ -15,6 +15,6 @@ if [[ $DELETE_FONT_CACHE == 1 ]]; then rm -rf ~/.cache/matplotlib fi -echo The following args are passed to pytest $PYTEST_ARGS $RUN_PEP8 +echo The following args are passed to pytest $PYTEST_ARGS $RUN_FLAKE8 -python -mpytest $PYTEST_ARGS $RUN_PEP8 +python -mpytest $PYTEST_ARGS $RUN_FLAKE8 diff --git a/pytest.ini b/pytest.ini index b0b9fe45ac72..860a9970a2fe 100644 --- a/pytest.ini +++ b/pytest.ini @@ -9,7 +9,7 @@ markers = flake8-max-line-length = 80 flake8-ignore = - *.py E114 E116 E122 E127 E128 E129 E131 E202 E203 E225 E261 E265 E305 E722 E741 F401 F403 F811 F841 + * E111 E114 E115 E116 E121 E122 E123 E124 E125 E126 E127 E128 E129 E131 E226 E240 E241 E242 E243 E244 E245 E246 E247 E248 E249 E265 E266 E305 E306 E704 E722 E741 F401 F403 F811 F841 W503 tools/boilerplate.py E501 setup.py E402