Add fast8 tox env
This was taken from the nova project, fast8 will allow running flake8 tests on a subset of changes (only HEAD) which is quicker. Change-Id: I9069edad75befcd4995a1c23924e2856da56c216 Signed-off-by: Arnaud M <arnaud.morin@gmail.com>
This commit is contained in:
parent
bcc071cf13
commit
800c3dbf93
24
tools/flake8wrap.sh
Executable file
24
tools/flake8wrap.sh
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# A simple wrapper around flake8 which makes it possible
|
||||
# to ask it to only verify files changed in the current
|
||||
# git HEAD patch.
|
||||
#
|
||||
# Intended to be invoked via tox:
|
||||
#
|
||||
# tox -epep8 -- -HEAD
|
||||
# or
|
||||
# tox -efast8
|
||||
#
|
||||
|
||||
if test "x$1" = "x-HEAD" ; then
|
||||
shift
|
||||
files=$(git diff --name-only HEAD~1 | tr '\n' ' ')
|
||||
echo "Running flake8 on ${files}"
|
||||
echo ""
|
||||
diff -u --from-file /dev/null ${files} | flake8 "$@"
|
||||
else
|
||||
echo "Running flake8 on all files"
|
||||
echo ""
|
||||
exec flake8 "$@"
|
||||
fi
|
6
tox.ini
6
tox.ini
@ -33,6 +33,12 @@ commands =
|
||||
doc8 doc/source
|
||||
flake8 {posargs} . {toxinidir}/tools/sync_db.py
|
||||
|
||||
[testenv:fast8]
|
||||
description =
|
||||
Run style checks on the changes made since HEAD~. For a full run including docs, use 'pep8'
|
||||
commands =
|
||||
bash tools/flake8wrap.sh -HEAD
|
||||
|
||||
# Deprecated
|
||||
[testenv:unit-postgresql]
|
||||
description =
|
||||
|
Loading…
Reference in New Issue
Block a user