Merge "Run tools/hacking.py instead of pep8 mandatory."

This commit is contained in:
Jenkins 2012-04-10 17:36:06 +00:00 committed by Gerrit Code Review
commit 66c900084e
3 changed files with 7 additions and 22 deletions

View File

@ -221,7 +221,7 @@ class QuantumMelangeIPAMLib(object):
def get_instance_ids_by_ip_address(self, context, address): def get_instance_ids_by_ip_address(self, context, address):
ips = self.m_conn.get_allocated_ips_by_address(address) ips = self.m_conn.get_allocated_ips_by_address(address)
# TODO (aaron.lee) melange should be storing & returning instance_uuid! # TODO(aaron.lee): melange should be storing & returning instance_uuid!
return [ip.get('used_by_device') for ip in ips] return [ip.get('used_by_device') for ip in ips]
def verify_subnet_exists(self, context, project_id, quantum_net_id): def verify_subnet_exists(self, context, project_id, quantum_net_id):

View File

@ -39,7 +39,7 @@ from nova import log as logging
from nova.openstack.common import cfg from nova.openstack.common import cfg
from nova import utils from nova import utils
from nova import service from nova import service
from nova.tests import reset_db from nova import tests
from nova.virt import fake from nova.virt import fake
@ -129,7 +129,7 @@ class TestCase(unittest.TestCase):
# now that we have some required db setup for the system # now that we have some required db setup for the system
# to work properly. # to work properly.
self.start = utils.utcnow() self.start = utils.utcnow()
reset_db() tests.reset_db()
# emulate some of the mox stuff, we can't use the metaclass # emulate some of the mox stuff, we can't use the metaclass
# because it screws with our generators # because it screws with our generators

View File

@ -13,9 +13,8 @@ function usage {
echo " -n, --no-recreate-db Don't recreate the test database." echo " -n, --no-recreate-db Don't recreate the test database."
echo " -x, --stop Stop running tests after the first error or failure." echo " -x, --stop Stop running tests after the first error or failure."
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 " -p, --pep8 Just run pep8" echo " -p, --pep8 Just run PEP8 and HACKING compliance check"
echo " -P, --no-pep8 Don't run pep8" echo " -P, --no-pep8 Don't run static code checks"
echo " -H, --hacking Just run HACKING compliance testing"
echo " -c, --coverage Generate coverage report" echo " -c, --coverage Generate coverage report"
echo " -h, --help Print this usage message" echo " -h, --help Print this usage message"
echo " --hide-elapsed Don't print the elapsed time for each test along with slow test list" echo " --hide-elapsed Don't print the elapsed time for each test along with slow test list"
@ -39,7 +38,6 @@ function process_option {
-f|--force) force=1;; -f|--force) force=1;;
-p|--pep8) just_pep8=1;; -p|--pep8) just_pep8=1;;
-P|--no-pep8) no_pep8=1;; -P|--no-pep8) no_pep8=1;;
-H|--hacking) just_hacking=1;;
-c|--coverage) coverage=1;; -c|--coverage) coverage=1;;
-*) noseopts="$noseopts $1";; -*) noseopts="$noseopts $1";;
*) noseargs="$noseargs $1" *) noseargs="$noseargs $1"
@ -58,7 +56,6 @@ noseopts=
wrapper="" wrapper=""
just_pep8=0 just_pep8=0
no_pep8=0 no_pep8=0
just_hacking=0
coverage=0 coverage=0
recreate_db=1 recreate_db=1
patch_migrate=1 patch_migrate=1
@ -109,16 +106,10 @@ srcfiles+=" `find ${xen_api_path} ${xen_net_path} -type f ! -name "*.patch" ! -n
srcfiles+=" setup.py" srcfiles+=" setup.py"
function run_pep8 { function run_pep8 {
echo "Running pep8 ..." echo "Running PEP8 and HACKING compliance check..."
# Just run PEP8 in current environment # Just run PEP8 in current environment
# #
${wrapper} pep8 ${srcfiles} ${wrapper} python tools/hacking.py ${srcfiles}
}
function run_hacking {
echo "Running hacking compliance testing..."
hacking_opts="--ignore=E202"
${wrapper} python tools/hacking.py ${hacking_opts} ${srcfiles}
} }
@ -160,12 +151,6 @@ if [ $just_pep8 -eq 1 ]; then
exit exit
fi fi
if [ $just_hacking -eq 1 ]; then
run_hacking
exit
fi
if [ $recreate_db -eq 1 ]; then if [ $recreate_db -eq 1 ]; then
rm -f tests.sqlite rm -f tests.sqlite
fi fi