diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2014-08-31 18:51:55 +0200 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2014-09-09 20:54:07 +0200 |
| commit | c981d9140d569d489d338741b6a3d878c4e712da (patch) | |
| tree | d5fe15130afa17cdb6ea08e81c691521a7847f88 /tests/apps | |
| parent | a8ded528b3c2f66d56f1f5499cf2021f3829c8e4 (diff) | |
[1.7.x] Fixed #22920 -- Avoid masking some exceptions.
If loading an application trigger an ImportError, the details of that
error were lost in some cases. Thanks Ben Davis for the report.
Backport of b161c01 from master
Diffstat (limited to 'tests/apps')
| -rw-r--r-- | tests/apps/failing_app/__init__.py | 1 | ||||
| -rw-r--r-- | tests/apps/tests.py | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/tests/apps/failing_app/__init__.py b/tests/apps/failing_app/__init__.py new file mode 100644 index 0000000000..4ec7f18d40 --- /dev/null +++ b/tests/apps/failing_app/__init__.py @@ -0,0 +1 @@ +raise ImportError("Oops") diff --git a/tests/apps/tests.py b/tests/apps/tests.py index 2c7629ac97..513ed32039 100644 --- a/tests/apps/tests.py +++ b/tests/apps/tests.py @@ -166,6 +166,14 @@ class AppsTests(TestCase): with self.settings(INSTALLED_APPS=['apps.apps.RelabeledAppsConfig', 'apps']): pass + def test_import_exception_is_not_masked(self): + """ + App discovery should preserve stack traces. Regression test for #22920. + """ + with six.assertRaisesRegex(self, ImportError, "Oops"): + with self.settings(INSTALLED_APPS=['apps.failing_app']): + pass + def test_models_py(self): """ Tests that the models in the models.py file were loaded correctly. |
