Catch all errors in Mock detector

It turns out that some modules may throw exceptions
other than ImportError from their class members.
The mock detector should ignore those.

Change-Id: I513c573982250e24b94ec5e649cf2c9e2799334c
Closes-Bug: 1524918
This commit is contained in:
Petr Malik 2015-12-10 12:40:47 -05:00
parent 39dd3f0fac
commit e8d9a3647a
1 changed files with 4 additions and 0 deletions

View File

@ -112,6 +112,10 @@ class TestCase(testtools.TestCase):
full_name, member, container, depth + 1)
except ImportError:
pass # Module cannot be imported - ignore it.
except RuntimeError:
# Something else went wrong when probing the class member.
# See: https://bugs.launchpad.net/trove/+bug/1524918
pass
def _get_loaded_modules(self):
return {name: obj for name, obj in sys.modules.items() if obj}