From 5dd5625d976603bcba8152c0476290d0aa81f5d7 Mon Sep 17 00:00:00 2001 From: Attila Fazekas Date: Tue, 5 Feb 2013 17:51:17 +0100 Subject: Module import style checking changes * Implementing the * import detection (it is disabled for now) * New style relative import testing based on syntax rules * Old style relative import testing based on module search * Inspection based solution replaced by PYTHONPATH search in order to avoid module compile and initialization steps (code execution) in a syntax checking phase. This solution is faster and safer, but does not able to recognize modules added dynamically to the module scope. Change-Id: Ifc871f4fdbcd4a9a736170ceb4475f4f2cbe66bc --- run_tests.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'run_tests.sh') diff --git a/run_tests.sh b/run_tests.sh index be9b0fa73..1f269fbfe 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -93,6 +93,8 @@ export venv_name export tools_dir export venv=${venv_path}/${venv_dir} +SCRIPT_ROOT=$(dirname $(readlink -f "$0")) + if [ $no_site_packages -eq 1 ]; then installvenvopts="--no-site-packages" fi @@ -156,12 +158,11 @@ function run_pep8 { srcfiles=`find nova -type f -name "*.py" ! -wholename "nova\/openstack*"` srcfiles+=" `find bin -type f ! -name "nova.conf*" ! -name "*api-paste.ini*" ! -name "*~"`" srcfiles+=" `find tools -type f -name "*.py"`" - srcfiles+=" `find plugins -type f -name "*.py"`" srcfiles+=" `find smoketests -type f -name "*.py"`" srcfiles+=" setup.py" # Until all these issues get fixed, ignore. - ignore='--ignore=E12,E711,E721,E712,N403,N404' + ignore='--ignore=E12,E711,E721,E712,N403,N404,N303' # First run the hacking selftest, to make sure it's right echo "Running hacking.py self test" @@ -171,6 +172,10 @@ function run_pep8 { echo "Running pep8" ${wrapper} python tools/hacking.py ${ignore} ${srcfiles} + PYTHONPATH=$SCRIPT_ROOT/plugins/xenserver/networking/etc/xensource/scripts ${wrapper} python tools/hacking.py ${ignore} ./plugins/xenserver/networking + + PYTHONPATH=$SCRIPT_ROOT/plugins/xenserver/xenapi/etc/xapi.d/plugins ${wrapper} python tools/hacking.py ${ignore} ./plugins/xenserver/xenapi + ${wrapper} bash tools/unused_imports.sh # NOTE(sdague): as of grizzly-2 these are passing however leaving the comment # in here in case we need to break it out when we get more of our hacking working -- cgit