[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.
This commit is contained in:
Calum Lind 2018-10-05 15:33:26 +01:00
parent a8a4fb69c0
commit 9e29fe4111
3 changed files with 18 additions and 7 deletions

View File

@ -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:

View File

@ -4,7 +4,6 @@ environment:
APPVEYOR_SAVE_CACHE_ON_ERROR: true
matrix:
- TOXENV: flake8
- TOXENV: pydef
- TOXENV: pygtkui
- TOXENV: plugins

10
tox.ini
View File

@ -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.