Fix outstanding pep8 errors for a clean trunk.

Also, add an option to run_tests.sh to skip running pep8. We have a separate
job in Jenkins which runs pep8, so there's no need to spin our wheels on it
during the test run.

Change-Id: I552330994e55a36fa96b63658493ed30e2720c85
This commit is contained in:
Monty Taylor 2011-09-22 18:22:42 -04:00 committed by Brian Waldon
parent 04d9226da0
commit f4c2d2830a
3 changed files with 17 additions and 11 deletions

View File

@ -1069,7 +1069,7 @@ class ZoneRedirectTest(test.TestCase):
self.assertEquals(decorator.get_collection_context_and_id(
(None, 10, 20), {}), ("servers", 10, 20))
self.assertEquals(decorator.get_collection_context_and_id(
(None, 11,), dict(instance_id=21)), ("servers", 11, 21))
(None, 11,), dict(instance_id=21)), ("servers", 11, 21))
self.assertEquals(decorator.get_collection_context_and_id(
(None,), dict(context=12, instance_id=22)), ("servers", 12, 22))

View File

@ -159,14 +159,14 @@ class LibvirtConnTestCase(test.TestCase):
self.flags(instances_path='')
self.call_libvirt_dependant_setup = False
test_instance = {'memory_kb': '1024000',
'basepath': '/some/path',
'bridge_name': 'br100',
'vcpus': 2,
'project_id': 'fake',
'bridge': 'br101',
'image_ref': '123456',
'local_gb': 20,
test_instance = {'memory_kb': '1024000',
'basepath': '/some/path',
'bridge_name': 'br100',
'vcpus': 2,
'project_id': 'fake',
'bridge': 'br101',
'image_ref': '123456',
'local_gb': 20,
'instance_type_id': '5'} # m1.small
def lazy_load_library_exists(self):

View File

@ -13,6 +13,7 @@ function usage {
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 " -p, --pep8 Just run pep8"
echo " -P, --no-pep8 Don't run pep8"
echo " -c, --coverage Generate coverage report"
echo " -h, --help Print this usage message"
echo " --hide-elapsed Don't print the elapsed time for each test along with slow test list"
@ -32,6 +33,7 @@ function process_option {
-n|--no-recreate-db) recreate_db=0;;
-f|--force) force=1;;
-p|--pep8) just_pep8=1;;
-P|--no-pep8) no_pep8=1;;
-c|--coverage) coverage=1;;
-*) noseopts="$noseopts $1";;
*) noseargs="$noseargs $1"
@ -47,6 +49,7 @@ noseargs=
noseopts=
wrapper=""
just_pep8=0
no_pep8=0
coverage=0
recreate_db=1
@ -87,7 +90,8 @@ function run_pep8 {
srcfiles+=" nova setup.py plugins/xenserver/xenapi/etc/xapi.d/plugins/glance"
# Just run PEP8 in current environment
${wrapper} pep8 --repeat --show-pep8 --show-source \
--exclude=vcsversion.py ${srcfiles}
--ignore=E202 \
--exclude=vcsversion.py ${srcfiles}
}
NOSETESTS="python run_tests.py $noseopts $noseargs"
@ -139,7 +143,9 @@ run_tests
# distinguish between options (noseopts), which begin with a '-', and
# arguments (noseargs).
if [ -z "$noseargs" ]; then
run_pep8
if [ $no_pep8 -eq 0 ]; then
run_pep8
fi
fi
if [ $coverage -eq 1 ]; then