Run flake8 tests automatically on ./run_tests.sh

And add a -P option to disable it.

Change-Id: Ie0039217c82acbd9c9071da27027f57263b39f25
Closes-bug: #1237202
This commit is contained in:
Kieran Spear 2013-10-09 16:21:22 +11:00
parent ffced623c3
commit 3dbb31b81a
2 changed files with 15 additions and 5 deletions

View File

@ -25,6 +25,7 @@ function usage {
echo " --makemessages Update all translation files."
echo " --compilemessages Compile all translation files."
echo " -p, --pep8 Just run pep8"
echo " -P, --no-pep8 Don't run pep8 by default"
echo " -t, --tabs Check for tab characters in files."
echo " -y, --pylint Just run pylint"
echo " -q, --quiet Run non-interactively. (Relatively) quiet."
@ -60,6 +61,7 @@ command_wrapper=""
destroy=0
force=0
just_pep8=0
no_pep8=0
just_pylint=0
just_docs=0
just_tabs=0
@ -91,6 +93,7 @@ function process_option {
-V|--virtual-env) always_venv=1; never_venv=0;;
-N|--no-virtual-env) always_venv=0; never_venv=1;;
-p|--pep8) just_pep8=1;;
-P|--no-pep8) no_pep8=1;;
-y|--pylint) just_pylint=1;;
-f|--force) force=1;;
-t|--tabs) just_tabs=1;;
@ -321,12 +324,19 @@ function run_tests_all {
# Remove the leftover coverage files from the -p flag earlier.
rm -f .coverage.*
if [ $(($HORIZON_RESULT || $DASHBOARD_RESULT)) -eq 0 ]; then
PEP8_RESULT=0
if [ $no_pep8 -eq 0 ] && [ $only_selenium -eq 0 ]; then
run_pep8
PEP8_RESULT=$?
fi
TEST_RESULT=$(($HORIZON_RESULT || $DASHBOARD_RESULT || $PEP8_RESULT))
if [ $TEST_RESULT -eq 0 ]; then
echo "Tests completed successfully."
else
echo "Tests failed."
fi
exit $(($HORIZON_RESULT || $DASHBOARD_RESULT))
exit $TEST_RESULT
}
function run_makemessages {

View File

@ -10,7 +10,7 @@ setenv = VIRTUAL_ENV={envdir}
NOSE_OPENSTACK_SHOW_ELAPSED=1
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = /bin/bash run_tests.sh -N
commands = /bin/bash run_tests.sh -N --no-pep8
[testenv:pep8]
commands = /bin/bash run_tests.sh -N --pep8
@ -19,12 +19,12 @@ commands = /bin/bash run_tests.sh -N --pep8
commands = {posargs}
[testenv:cover]
commands = /bin/bash run_tests.sh -N --coverage
commands = /bin/bash run_tests.sh -N --no-pep8 --coverage
[testenv:py27dj14]
basepython = python2.7
commands = pip install django==1.4
/bin/bash run_tests.sh -N
/bin/bash run_tests.sh -N --no-pep8
[tox:jenkins]
downloadcache = ~/cache/pip