tox: Integrate 'flake8wrap' script

Integrate the 'flake8wrap' scripts, which provide useful functionality.

Change-Id: I06d7d9d816d855b6ce4f1748b29a3ed916e3bbf8
Partial-Bug: #1535772
This commit is contained in:
Stephen Finucane 2016-01-19 05:32:41 +00:00 committed by Waldemar Znoinski
parent 5e7ade513a
commit 0a8d11b07d
2 changed files with 26 additions and 3 deletions

20
tools/flake8wrap.sh Executable file
View File

@ -0,0 +1,20 @@
#!/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
#
if test "x$1" = "x-HEAD" ; then
shift
files=$(git diff --name-only HEAD~1 | tr '\n' ' ')
echo "Running flake8 on ${files}"
diff -u --from-file /dev/null ${files} | flake8 --diff "$@"
else
echo "Running flake8 on all files"
exec flake8 "$@"
fi

View File

@ -5,14 +5,17 @@ skipsdist = True
[testenv]
usedevelop = True
setenv =
PYTHONPATH = {toxinidir}:{toxinidir}/intel_nfv_ci_tests
whitelist_externals = bash
find
rm
deps =
-r{toxinidir}/test-requirements.txt
commands =
find . -type f -name "*.pyc" -delete
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
[testenv:pep8]
commands = flake8
commands = bash tools/flake8wrap.sh {posargs}
[testenv:venv]
commands = {posargs}