Fixed #29464 -- Silenced post-process messages in collectstatic's default verbosity.

This commit is contained in:
Arthur Silva 2018-06-09 18:12:43 -04:00 committed by Tim Graham
parent 860903b261
commit bc1435551c
2 changed files with 14 additions and 1 deletions

View File

@ -134,7 +134,7 @@ class Command(BaseCommand):
raise processed raise processed
if processed: if processed:
self.log("Post-processed '%s' as '%s'" % self.log("Post-processed '%s' as '%s'" %
(original_path, processed_path), level=1) (original_path, processed_path), level=2)
self.post_processed_files.append(original_path) self.post_processed_files.append(original_path)
else: else:
self.log("Skipped post-processing '%s'" % original_path) self.log("Skipped post-processing '%s'" % original_path)

View File

@ -179,6 +179,7 @@ class TestCollection(TestDefaults, CollectionTestCase):
class TestCollectionVerbosity(CollectionTestCase): class TestCollectionVerbosity(CollectionTestCase):
copying_msg = 'Copying ' copying_msg = 'Copying '
run_collectstatic_in_setUp = False run_collectstatic_in_setUp = False
post_process_msg = 'Post-processed'
staticfiles_copied_msg = 'static files copied to' staticfiles_copied_msg = 'static files copied to'
def test_verbosity_0(self): def test_verbosity_0(self):
@ -200,6 +201,18 @@ class TestCollectionVerbosity(CollectionTestCase):
self.assertIn(self.staticfiles_copied_msg, output) self.assertIn(self.staticfiles_copied_msg, output)
self.assertIn(self.copying_msg, output) self.assertIn(self.copying_msg, output)
@override_settings(STATICFILES_STORAGE='django.contrib.staticfiles.storage.CachedStaticFilesStorage')
def test_verbosity_1_with_post_process(self):
stdout = StringIO()
self.run_collectstatic(verbosity=1, stdout=stdout, post_process=True)
self.assertNotIn(self.post_process_msg, stdout.getvalue())
@override_settings(STATICFILES_STORAGE='django.contrib.staticfiles.storage.CachedStaticFilesStorage')
def test_verbosity_2_with_post_process(self):
stdout = StringIO()
self.run_collectstatic(verbosity=2, stdout=stdout, post_process=True)
self.assertIn(self.post_process_msg, stdout.getvalue())
class TestCollectionClear(CollectionTestCase): class TestCollectionClear(CollectionTestCase):
""" """