#29464 closed Cleanup/optimization (fixed)
Move collectstatic post processing messages to verbosity 2
Reported by: | David Szotten | Owned by: | Arthur Silva |
---|---|---|---|
Component: | contrib.staticfiles | Version: | 2.1 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
collectstatic
logs "Post-processed foo as bar
with level 1, but this is a lot of output and may be more suitable to
level 2, like "Copying foo"
Change History (11)
comment:1 by , 6 years ago
Component: | Core (Management commands) → contrib.staticfiles |
---|---|
Summary: | collectstatic verbosity → Move collectstatic post processing messages to verbosity 2 |
Type: | Uncategorized → Cleanup/optimization |
Version: | 2.0 → 2.1 |
comment:2 by , 6 years ago
Easy pickings: | set |
---|
comment:3 by , 6 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:4 by , 6 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:5 by , 6 years ago
Hi @Tim Graham,
How can I test post_process inside TestCollectionVerbosity class located in django/tests/staticfiles_tests/test_management.py ?
I've tried:
def test_verbosity_1(self): stdout = StringIO() self.run_collectstatic(verbosity=1, stdout=stdout, post_process=True) output = stdout.getvalue() self.assertIn(self.staticfiles_copied_msg, output) self.assertNotIn(self.copying_msg, output) self.assertNotIn(self.post_process_msg, output)
where self.post_process_msg is equal to 'Post-process'.
However I can't make post_process be triggered. So, the test passes even message post_process_msg is printed with verbose=1.
I may be missing some 'storage' initialization.
Can you give a hint, please?
Thanks.
comment:6 by , 6 years ago
you probably need to enable a storage backend that uses post processing, e.g. using
@override_settings(STATICFILES_STORAGE='django.contrib.staticfiles.storage.CachedStaticFilesStorage') def test_foo(self):
comment:7 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Thanks David.
I've submitted a PR.
comment:8 by , 6 years ago
Has patch: | set |
---|---|
Resolution: | fixed |
Status: | closed → new |
The ticket is closed when the PR is merged. You should instead check "Has patch" when adding a pull request.
(Follow up to #28973.)