Merge "Fix hacking tests on osx"

This commit is contained in:
Jenkins 2013-02-19 03:38:29 +00:00 committed by Gerrit Code Review
commit 9d9bed9e68
2 changed files with 11 additions and 5 deletions

View File

@ -48,7 +48,8 @@ logging.disable('LOG')
IMPORT_EXCEPTIONS = ['sqlalchemy', 'migrate', 'nova.db.sqlalchemy.session',
'nova.openstack.common.log.logging',
'nova.db.sqlalchemy.migration.versioning_api']
'nova.db.sqlalchemy.migration.versioning_api', 'paste']
# Paste is missing a __init__ in top level directory
START_DOCSTRING_TRIPLE = ['u"""', 'r"""', '"""', "u'''", "r'''", "'''"]
END_DOCSTRING_TRIPLE = ['"""', "'''"]
VERBOSE_MISSING_IMPORT = os.getenv('HACKING_VERBOSE_MISSING_IMPORT', 'False')
@ -187,9 +188,12 @@ def nova_import_rules(logical_line):
# pass the doctest, since the relativity depends on the file's locality
def is_module_for_sure(mod, search_path=sys.path):
mod_path = mod.replace('.', os.sep)
try:
imp.find_module(mod_path, search_path)
while '.' in mod:
pack_name, _sep, mod = mod.partition('.')
f, p, d = imp.find_module(pack_name, search_path)
search_path = [p]
imp.find_module(mod, search_path)
except ImportError:
return False
return True

View File

@ -1,4 +1,6 @@
#!/bin/bash
set -e
# This is used by run_tests.sh and tox.ini
python tools/hacking.py --doctest
@ -12,7 +14,7 @@ ${PEP8} ${EXCLUDE} .
${PEP8} --filename=nova* bin
SCRIPT_ROOT=$(echo $(dirname $(readlink -f "$0")) | sed s/\\/tools//)
SCRIPT_ROOT=$(echo $(cd "$(dirname $0)"; pwd) | sed s/\\/tools//)
SCRIPTS_PATH=${SCRIPT_ROOT}/plugins/xenserver/networking/etc/xensource/scripts
PYTHONPATH=${SCRIPTS_PATH} ${PEP8} ./plugins/xenserver/networking
@ -20,6 +22,6 @@ PYTHONPATH=${SCRIPTS_PATH} ${PEP8} ./plugins/xenserver/networking
# NOTE(sirp): Also check Dom0 plugins w/o .py extension
PLUGINS_PATH=${SCRIPT_ROOT}/plugins/xenserver/xenapi/etc/xapi.d/plugins
PYTHONPATH=${PLUGINS_PATH} ${PEP8} ./plugins/xenserver/xenapi \
`find plugins/xenserver/xenapi/etc/xapi.d/plugins/ -type f -perm +111`
`find plugins/xenserver/xenapi/etc/xapi.d/plugins -type f -perm +111`
! pyflakes nova/ | grep "imported but unused"