From e19d8dd84b8aec9d6b7dc00e5e5dd624b7b7fd5a Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sun, 13 Jan 2019 08:55:06 -0800 Subject: [PATCH] Add linting to the tox matrix Allows contributors to easily run the lint stage with a single command: `tox -e lint`. This creates shorter round trips with CI in case of an error. Update the Travis configuration to use the new environment to run lint. This allows using a single/common source of truth to reduce differences between Travis and local testing. The tox environment uses the skip_install feature as static analysis doesn't requiring install the Pillow package itself to run. This feature requires tox 1.9 (2015-02-24), so a minimum tox version was added to the configuration. https://tox.readthedocs.io/en/latest/config.html#conf-skip_install --- .travis.yml | 5 ++--- tox.ini | 14 +++++++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index f7cb5899c..306bf5b33 100644 --- a/.travis.yml +++ b/.travis.yml @@ -67,7 +67,7 @@ services: install: - | if [ "$LINT" == "true" ]; then - pip install -U check-manifest flake8 + pip install tox elif [ "$DOCKER" == "" ]; then .travis/install.sh; fi @@ -83,8 +83,7 @@ before_script: script: - | if [ "$LINT" == "true" ]; then - flake8 --statistics --count - check-manifest + tox -e lint elif [ "$DOCKER" == "" ]; then .travis/script.sh elif [ "$DOCKER" ]; then diff --git a/tox.ini b/tox.ini index 3ae11eea0..7aa4e7b23 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,10 @@ # and then run "tox" from this directory. [tox] -envlist = py27, py34, py35, py36, py37 +envlist = + lint + py{27,34,35,36,37} +minversion = 1.9 [testenv] commands = @@ -18,3 +21,12 @@ deps = olefile pyroma pytest + +[testenv:lint] +commands = + flake8 --statistics --count + check-manifest +deps = + check-manifest + flake8 +skip_install = true