From e8d9a3647acc4841f401cb650c5649e87b0a8d6f Mon Sep 17 00:00:00 2001 From: Petr Malik Date: Thu, 10 Dec 2015 12:40:47 -0500 Subject: [PATCH] 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 --- trove/tests/unittests/trove_testtools.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/trove/tests/unittests/trove_testtools.py b/trove/tests/unittests/trove_testtools.py index 9213b64e9f..c4d5291a92 100644 --- a/trove/tests/unittests/trove_testtools.py +++ b/trove/tests/unittests/trove_testtools.py @@ -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}