From 9e29fe41113b78e5d38621eacfc9f817f8b9b3d2 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Fri, 5 Oct 2018 15:33:26 +0100 Subject: [PATCH] [Tests] Lint with pre-commit - Add lint section to tox. - Replace flake8 with lint on Travis and remove commented out sections. - Remove flake8 from appveyor to reduce sequential testing time. --- .travis.yml | 14 +++++++++----- appveyor.yml | 1 - tox.ini | 10 +++++++++- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index cd8fa102d..d0b77bfaa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,14 @@ before_install: - lsb_release -a - sudo add-apt-repository ppa:deluge-team/develop -yu +addons: + apt: + sources: + - deadsnakes + packages: + # Need Py 3.6 specifically for pre-commit to run black formatter. + - python3.6 + # command to install dependencies install: - bash -c "echo $APTPACKAGES" @@ -33,13 +41,9 @@ matrix: - env: TOX_ENV=pydef - if: commit_message =~ SECURITY_TEST env: TOX_ENV=security - - env: TOX_ENV=flake8 - #- env: TOX_ENV=flake8-complexity + - env: TOX_ENV=lint - env: TOX_ENV=docs - #- env: TOX_ENV=todo - #- env: TOX_ENV=trial APTPACKAGES="$APTPACKAGES $APTPACKAGES_GTKUI" - env: TOX_ENV=pygtkui APTPACKAGES="$APTPACKAGES $APTPACKAGES_GTKUI" - #- env: TOX_ENV=testcoverage APTPACKAGES="$APTPACKAGES $APTPACKAGES_GTKUI" - env: TOX_ENV=plugins virtualenv: diff --git a/appveyor.yml b/appveyor.yml index ccc45d4dd..1f6a71e6f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,7 +4,6 @@ environment: APPVEYOR_SAVE_CACHE_ON_ERROR: true matrix: - - TOXENV: flake8 - TOXENV: pydef - TOXENV: pygtkui - TOXENV: plugins diff --git a/tox.ini b/tox.ini index fc008dfce..99e5a06cb 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # Usage: `pip install tox` and then run `tox` from this directory. [tox] -envlist = py27, flake8, docs +envlist = py27, lint, docs minversion=2.0 [base] @@ -79,6 +79,14 @@ commands = {[testenv:pydef]commands} # Code linting # ======================= +[testenv:lint] +passenv = HOMEPATH SSH_AUTH_SOCK +deps = + pre-commit + slimit +commands = + pre-commit run --all-files + [testenv:flake8] # Disable site packages to avoid using system flake8 which uses # hardcoded python path which imports the wrong libraries.