summaryrefslogtreecommitdiff
path: root/tests/utils_tests/module_loading.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/utils_tests/module_loading.py')
-rw-r--r--tests/utils_tests/module_loading.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/utils_tests/module_loading.py b/tests/utils_tests/module_loading.py
index cd97e1436d..0a905ef2f1 100644
--- a/tests/utils_tests/module_loading.py
+++ b/tests/utils_tests/module_loading.py
@@ -120,6 +120,16 @@ class ModuleImportTestCase(unittest.TestCase):
import_by_path('unexistent.module.path', error_prefix="Foo")
self.assertTrue(str(cm.exception).startswith('Foo'))
+ def test_import_error_traceback(self):
+ """Test preserving the original traceback on an ImportError."""
+ try:
+ import_by_path('test_module.bad_module.content')
+ except ImproperlyConfigured:
+ traceback = sys.exc_info()[2]
+
+ self.assertIsNotNone(traceback.tb_next.tb_next,
+ 'Should have more than the calling frame in the traceback.')
+
class ProxyFinder(object):
def __init__(self):