diff options
author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-04-28 16:45:05 +0200 |
---|---|---|
committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-04-28 16:45:05 +0200 |
commit | 90fe9141ded9f7005546e9a66f31fd196f60e7e4 (patch) | |
tree | b7e0679da7453fa9135037dc58443b4891267556 /tests | |
parent | f7f69cf7dd2730f3cf07f8dc71fc60b6c15bbf64 (diff) | |
download | django-90fe9141ded9f7005546e9a66f31fd196f60e7e4.tar.gz |
Fixed #18986 -- Improved error message for missing files
in CachedStaticFilesStorage. Thanks zyegfryed for his work on the patch.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/staticfiles_tests/project/faulty/faulty.css | 1 | ||||
-rw-r--r-- | tests/staticfiles_tests/tests.py | 17 |
2 files changed, 17 insertions, 1 deletions
diff --git a/tests/staticfiles_tests/project/faulty/faulty.css b/tests/staticfiles_tests/project/faulty/faulty.css new file mode 100644 index 0000000000..ca57c77e55 --- /dev/null +++ b/tests/staticfiles_tests/project/faulty/faulty.css @@ -0,0 +1 @@ +@import url("missing.css"); diff --git a/tests/staticfiles_tests/tests.py b/tests/staticfiles_tests/tests.py index 0391b8b018..912dcffe83 100644 --- a/tests/staticfiles_tests/tests.py +++ b/tests/staticfiles_tests/tests.py @@ -244,7 +244,7 @@ class TestCollection(CollectionTestCase, TestDefaults): class TestCollectionClear(CollectionTestCase): """ - Test the ``--clear`` option of the ``collectstatic`` managemenet command. + Test the ``--clear`` option of the ``collectstatic`` management command. """ def run_collectstatic(self, **kwargs): clear_filepath = os.path.join(settings.STATIC_ROOT, 'cleared.txt') @@ -550,6 +550,21 @@ class TestCollectionCachedStorage(BaseCollectionTestCase, self.assertNotIn(b"cached/other.css", content) self.assertIn(b"other.d41d8cd98f00.css", content) + @override_settings( + STATICFILES_DIRS=(os.path.join(TEST_ROOT, 'project', 'faulty'),), + STATICFILES_FINDERS=('django.contrib.staticfiles.finders.FileSystemFinder',), + ) + def test_post_processing_failure(self): + """ + Test that post_processing indicates the origin of the error when it + fails. Regression test for #18986. + """ + finders._finders.clear() + err = six.StringIO() + with self.assertRaises(Exception) as cm: + call_command('collectstatic', interactive=False, verbosity=0, stderr=err) + self.assertEqual("Post-processing 'faulty.css' failed!\n\n", err.getvalue()) + # we set DEBUG to False here since the template tag wouldn't work otherwise @override_settings(**dict(TEST_SETTINGS, |