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:
parent
ffced623c3
commit
3dbb31b81a
14
run_tests.sh
14
run_tests.sh
@ -25,6 +25,7 @@ function usage {
|
|||||||
echo " --makemessages Update all translation files."
|
echo " --makemessages Update all translation files."
|
||||||
echo " --compilemessages Compile all translation files."
|
echo " --compilemessages Compile all translation files."
|
||||||
echo " -p, --pep8 Just run pep8"
|
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 " -t, --tabs Check for tab characters in files."
|
||||||
echo " -y, --pylint Just run pylint"
|
echo " -y, --pylint Just run pylint"
|
||||||
echo " -q, --quiet Run non-interactively. (Relatively) quiet."
|
echo " -q, --quiet Run non-interactively. (Relatively) quiet."
|
||||||
@ -60,6 +61,7 @@ command_wrapper=""
|
|||||||
destroy=0
|
destroy=0
|
||||||
force=0
|
force=0
|
||||||
just_pep8=0
|
just_pep8=0
|
||||||
|
no_pep8=0
|
||||||
just_pylint=0
|
just_pylint=0
|
||||||
just_docs=0
|
just_docs=0
|
||||||
just_tabs=0
|
just_tabs=0
|
||||||
@ -91,6 +93,7 @@ function process_option {
|
|||||||
-V|--virtual-env) always_venv=1; never_venv=0;;
|
-V|--virtual-env) always_venv=1; never_venv=0;;
|
||||||
-N|--no-virtual-env) always_venv=0; never_venv=1;;
|
-N|--no-virtual-env) always_venv=0; never_venv=1;;
|
||||||
-p|--pep8) just_pep8=1;;
|
-p|--pep8) just_pep8=1;;
|
||||||
|
-P|--no-pep8) no_pep8=1;;
|
||||||
-y|--pylint) just_pylint=1;;
|
-y|--pylint) just_pylint=1;;
|
||||||
-f|--force) force=1;;
|
-f|--force) force=1;;
|
||||||
-t|--tabs) just_tabs=1;;
|
-t|--tabs) just_tabs=1;;
|
||||||
@ -321,12 +324,19 @@ function run_tests_all {
|
|||||||
# Remove the leftover coverage files from the -p flag earlier.
|
# Remove the leftover coverage files from the -p flag earlier.
|
||||||
rm -f .coverage.*
|
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."
|
echo "Tests completed successfully."
|
||||||
else
|
else
|
||||||
echo "Tests failed."
|
echo "Tests failed."
|
||||||
fi
|
fi
|
||||||
exit $(($HORIZON_RESULT || $DASHBOARD_RESULT))
|
exit $TEST_RESULT
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_makemessages {
|
function run_makemessages {
|
||||||
|
6
tox.ini
6
tox.ini
@ -10,7 +10,7 @@ setenv = VIRTUAL_ENV={envdir}
|
|||||||
NOSE_OPENSTACK_SHOW_ELAPSED=1
|
NOSE_OPENSTACK_SHOW_ELAPSED=1
|
||||||
deps = -r{toxinidir}/requirements.txt
|
deps = -r{toxinidir}/requirements.txt
|
||||||
-r{toxinidir}/test-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]
|
[testenv:pep8]
|
||||||
commands = /bin/bash run_tests.sh -N --pep8
|
commands = /bin/bash run_tests.sh -N --pep8
|
||||||
@ -19,12 +19,12 @@ commands = /bin/bash run_tests.sh -N --pep8
|
|||||||
commands = {posargs}
|
commands = {posargs}
|
||||||
|
|
||||||
[testenv:cover]
|
[testenv:cover]
|
||||||
commands = /bin/bash run_tests.sh -N --coverage
|
commands = /bin/bash run_tests.sh -N --no-pep8 --coverage
|
||||||
|
|
||||||
[testenv:py27dj14]
|
[testenv:py27dj14]
|
||||||
basepython = python2.7
|
basepython = python2.7
|
||||||
commands = pip install django==1.4
|
commands = pip install django==1.4
|
||||||
/bin/bash run_tests.sh -N
|
/bin/bash run_tests.sh -N --no-pep8
|
||||||
|
|
||||||
[tox:jenkins]
|
[tox:jenkins]
|
||||||
downloadcache = ~/cache/pip
|
downloadcache = ~/cache/pip
|
||||||
|
Loading…
Reference in New Issue
Block a user