diff options
author | Claude Paroz <claude@2xlibre.net> | 2023-03-12 12:28:00 +0100 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-03-12 16:54:20 +0100 |
commit | 03bc92af978f2148c1141673c730f17772cd7037 (patch) | |
tree | b07350231d8d9193c7f9790dc6f55ecc56cfb768 /tests/staticfiles_tests | |
parent | 4db33e96d1b5b4ba1a739e15b28835495f78eee4 (diff) | |
download | django-03bc92af978f2148c1141673c730f17772cd7037.tar.gz |
Fixed #34407 -- Reported filename when decoding fails in collectstatic's post_process.
Diffstat (limited to 'tests/staticfiles_tests')
-rw-r--r-- | tests/staticfiles_tests/project/nonutf8/nonutf8.css | 2 | ||||
-rw-r--r-- | tests/staticfiles_tests/test_storage.py | 12 |
2 files changed, 14 insertions, 0 deletions
diff --git a/tests/staticfiles_tests/project/nonutf8/nonutf8.css b/tests/staticfiles_tests/project/nonutf8/nonutf8.css new file mode 100644 index 0000000000..4d5e729088 --- /dev/null +++ b/tests/staticfiles_tests/project/nonutf8/nonutf8.css @@ -0,0 +1,2 @@ +/* éviter écrasement */ +.test { margin: 1 rem; } diff --git a/tests/staticfiles_tests/test_storage.py b/tests/staticfiles_tests/test_storage.py index 06df05e196..759582122d 100644 --- a/tests/staticfiles_tests/test_storage.py +++ b/tests/staticfiles_tests/test_storage.py @@ -368,6 +368,18 @@ class TestHashedFiles: self.assertEqual("Post-processing 'faulty.css' failed!\n\n", err.getvalue()) self.assertPostCondition() + @override_settings( + STATICFILES_DIRS=[os.path.join(TEST_ROOT, "project", "nonutf8")], + STATICFILES_FINDERS=["django.contrib.staticfiles.finders.FileSystemFinder"], + ) + def test_post_processing_nonutf8(self): + finders.get_finder.cache_clear() + err = StringIO() + with self.assertRaises(UnicodeDecodeError): + call_command("collectstatic", interactive=False, verbosity=0, stderr=err) + self.assertEqual("Post-processing 'nonutf8.css' failed!\n\n", err.getvalue()) + self.assertPostCondition() + @override_settings( STORAGES={ |