nose-devs/nose — Issue #448: ImportError masked by AttributeError
Author: jpellerin
Created: 2011-12-14 16:11:49+00:00
State: open

If a module has import error, the ImportError is masked by AttributeError.

There is a small change that can be done in util.py to trigger the ImportError

Instead of

log.debug("resolve: %s, %s, %s, %s", parts, name, obj, module)
for part in parts:
obj = getattr(obj, part)
return obj

it can use:

log.debug("resolve: %s, %s, %s, %s", parts, name, obj, module)
for part in parts:
try:
obj = getattr(obj, part)
except AttributeError:
# Try to import the module so that we can see the import error.
__import__(obj.__name__ + '.' + part)
return obj

This should also help with issue #368

----
I can also submit a patch if required

Google Code Info:
Issue #: 454
Author: adiroi...@gmail.com
Created On: 2011-09-09T12:46:28.000Z
Closed On: