Use flake8/hacking instead of pep8.

Change-Id: Ia99bc9116d7d8b558002b302cafe354d05d57f72
This commit is contained in:
Monty Taylor 2013-04-20 22:28:31 -07:00
parent 2781f41fbd
commit 66b3e5ec83
3 changed files with 29 additions and 19 deletions

View File

@ -9,8 +9,8 @@ function usage {
echo " -f, --force Force a clean re-build of the virtual environment. Useful when dependencies have been added." echo " -f, --force Force a clean re-build of the virtual environment. Useful when dependencies have been added."
echo " -u, --update Update the virtual environment with any newer package versions" echo " -u, --update Update the virtual environment with any newer package versions"
echo " --unittests-only Run unit tests only, exclude functional tests." echo " --unittests-only Run unit tests only, exclude functional tests."
echo " -p, --pep8 Just run pep8" echo " -p, --flake8 Just run flake8"
echo " -P, --no-pep8 Don't run static code checks" echo " -P, --no-flake8 Don't run static code checks"
echo " -h, --help Print this usage message" echo " -h, --help Print this usage message"
echo "" echo ""
echo "Note: with no options specified, the script will try to run the tests in a virtual environment," echo "Note: with no options specified, the script will try to run the tests in a virtual environment,"
@ -24,8 +24,8 @@ function process_option {
-h|--help) usage;; -h|--help) usage;;
-V|--virtual-env) let always_venv=1; let never_venv=0;; -V|--virtual-env) let always_venv=1; let never_venv=0;;
-N|--no-virtual-env) let always_venv=0; let never_venv=1;; -N|--no-virtual-env) let always_venv=0; let never_venv=1;;
-p|--pep8) let just_pep8=1;; -p|--flake8) let just_flake8=1;;
-P|--no-pep8) let no_pep8=1;; -P|--no-flake8) let no_flake8=1;;
-f|--force) let force=1;; -f|--force) let force=1;;
-u|--update) update=1;; -u|--update) update=1;;
--unittests-only) noseopts="$noseopts --exclude-dir=glance/tests/functional";; --unittests-only) noseopts="$noseopts --exclude-dir=glance/tests/functional";;
@ -43,8 +43,8 @@ force=0
noseopts= noseopts=
noseargs= noseargs=
wrapper="" wrapper=""
just_pep8=0 just_flake8=0
no_pep8=0 no_flake8=0
update=0 update=0
export NOSE_WITH_OPENSTACK=1 export NOSE_WITH_OPENSTACK=1
@ -66,14 +66,14 @@ function run_tests {
${wrapper} $NOSETESTS ${wrapper} $NOSETESTS
} }
function run_pep8 { function run_flake8 {
echo "Running pep8 ..." echo "Running flake8 ..."
PEP8_EXCLUDE=".venv,.tox,dist,doc,openstack" FLAKE8_EXCLUDE=".venv,.git,.tox,dist,doc,etc,*glance/locale*,*openstack/common*,*lib/python*,*egg,build"
PEP8_OPTIONS="--exclude=$PEP8_EXCLUDE --repeat" FLAKE8_OPTIONS="--exclude=$FLAKE8_EXCLUDE"
PEP8_IGNORE="--ignore=E125,E126,E711,E712" FLAKE8_IGNORE="--ignore=E125,E126,E711,E712,F,H"
PEP8_INCLUDE="." FLAKE8_INCLUDE="."
${wrapper} pep8 $PEP8_OPTIONS $PEP8_INCLUDE $PEP8_IGNORE ${wrapper} flake8 $FLAKE8_OPTIONS $FLAKE8_INCLUDE $FLAKE8_IGNORE
} }
@ -109,15 +109,15 @@ then
fi fi
fi fi
if [ $just_pep8 -eq 1 ]; then if [ $just_flake8 -eq 1 ]; then
run_pep8 run_flake8
exit exit
fi fi
run_tests || exit run_tests || exit
if [ -z "$noseargs" ]; then if [ -z "$noseargs" ]; then
if [ $no_pep8 -eq 0 ]; then if [ $no_flake8 -eq 0 ]; then
run_pep8 run_flake8
fi fi
fi fi

View File

@ -1,6 +1,12 @@
# Packages needed for dev testing # Packages needed for dev testing
distribute>=0.6.24 distribute>=0.6.24
# Install bounded pep8/pyflakes first, then let flake8 install
pep8==1.4.5
pyflakes==0.7.2
flake8==2.0
hacking>=0.5.3,<0.6
# For translations processing # For translations processing
Babel Babel
@ -12,7 +18,6 @@ nose
nose-exclude nose-exclude
openstack.nose_plugin>=0.7 openstack.nose_plugin>=0.7
nosehtmloutput>=0.0.3 nosehtmloutput>=0.0.3
pep8==1.3.3
sphinx>=1.1.2 sphinx>=1.1.2
requests requests
testtools>=0.9.22 testtools>=0.9.22

View File

@ -18,10 +18,15 @@ downloadcache = ~/cache/pip
[testenv:pep8] [testenv:pep8]
commands = commands =
pep8 --ignore=E125,E126,E711,E712 --repeat --show-source --exclude=.venv,.tox,dist,doc,openstack . flake8
[testenv:cover] [testenv:cover]
setenv = NOSE_WITH_COVERAGE=1 setenv = NOSE_WITH_COVERAGE=1
[testenv:venv] [testenv:venv]
commands = {posargs} commands = {posargs}
[flake8]
ignore = E125,E126,E711,E712,F,H
builtins = _
exclude = .venv,.git,.tox,dist,doc,etc,*glance/locale*,*openstack/common*,*lib/python*,*egg,build