summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/contrib/staticfiles/storage.py3
-rw-r--r--tests/staticfiles_tests/test_management.py5
2 files changed, 7 insertions, 1 deletions
diff --git a/django/contrib/staticfiles/storage.py b/django/contrib/staticfiles/storage.py
index ba3b62620d..cc0f0f8e23 100644
--- a/django/contrib/staticfiles/storage.py
+++ b/django/contrib/staticfiles/storage.py
@@ -398,7 +398,8 @@ class ManifestFilesMixin(HashedFilesMixin):
def post_process(self, *args, **kwargs):
self.hashed_files = {}
yield from super().post_process(*args, **kwargs)
- self.save_manifest()
+ if not kwargs.get('dry_run'):
+ self.save_manifest()
def save_manifest(self):
payload = {'paths': self.hashed_files, 'version': self.manifest_version}
diff --git a/tests/staticfiles_tests/test_management.py b/tests/staticfiles_tests/test_management.py
index c89240915b..7630efbd9b 100644
--- a/tests/staticfiles_tests/test_management.py
+++ b/tests/staticfiles_tests/test_management.py
@@ -334,6 +334,11 @@ class TestCollectionDryRun(TestNoFilesCreated, CollectionTestCase):
super().run_collectstatic(dry_run=True)
+@override_settings(STATICFILES_STORAGE='django.contrib.staticfiles.storage.ManifestStaticFilesStorage')
+class TestCollectionDryRunManifestStaticFilesStorage(TestCollectionDryRun):
+ pass
+
+
class TestCollectionFilesOverride(CollectionTestCase):
"""
Test overriding duplicated files by ``collectstatic`` management command.