Fix hacking.py to handle 'cannot import x'

Fix missingImport logic to handle a module that cannot be imported, due
to a missing dependant module.

Due to the nature of this bug doctests cannot cover it.

Fix bug 1133103

Change-Id: Ia067bacc125b67e2d9e0cfc72495e4f13a8648ad
This commit is contained in:
Joe Gordon
2013-02-25 19:44:29 -08:00
parent 0f0a8c6bcc
commit 99308d4dd3
+2 -1
View File
@@ -201,7 +201,8 @@ def nova_import_rules(logical_line):
# NOTE(vish): the import error might be due
# to a missing dependency
missing = str(exc).split()[-1]
if missing != mod.split('.')[-1]:
if (missing != mod.split('.')[-1] or
"cannot import" in str(exc)):
_missingImport.add(missing)
return True
return False