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:
Arnaud M 2024-10-06 11:20:20 +02:00
parent bcc071cf13
commit 800c3dbf93
2 changed files with 30 additions and 0 deletions

24
tools/flake8wrap.sh Executable file
View 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

View File

@ -33,6 +33,12 @@ commands =
doc8 doc/source doc8 doc/source
flake8 {posargs} . {toxinidir}/tools/sync_db.py 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 # Deprecated
[testenv:unit-postgresql] [testenv:unit-postgresql]
description = description =