Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#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"

https://github.com/django/django/blob/e1ebd22558342bb0088a3da3571863a20413fa2a/django/contrib/staticfiles/management/commands/collectstatic.py#L136

Change History (11)

comment:1 by Tim Graham, 6 years ago

Component: Core (Management commands)contrib.staticfiles
Summary: collectstatic verbosityMove collectstatic post processing messages to verbosity 2
Type: UncategorizedCleanup/optimization
Version: 2.02.1

(Follow up to #28973.)

comment:2 by Tim Graham, 6 years ago

Easy pickings: set

comment:3 by Tim Graham, 6 years ago

Triage Stage: UnreviewedAccepted

comment:4 by Arthur Silva, 6 years ago

Owner: changed from nobody to Arthur Silva
Status: newassigned

comment:5 by Arthur Silva, 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 David Szotten, 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):

see https://github.com/django/django/blob/7a266e25be1b641111ab5889f9808ff6d258d27f/django/contrib/staticfiles/management/commands/collectstatic.py#L125

comment:7 by Arthur Silva, 6 years ago

Resolution: fixed
Status: assignedclosed

Thanks David.

I've submitted a PR.

comment:8 by Tim Graham, 6 years ago

Has patch: set
Resolution: fixed
Status: closednew

The ticket is closed when the PR is merged. You should instead check "Has patch" when adding a pull request.

comment:9 by Arthur Silva, 6 years ago

My bad.

Thanks for changing it to "Has patch".

comment:10 by Tim Graham <timograham@…>, 6 years ago

Resolution: fixed
Status: newclosed

In bc143555:

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

comment:11 by Tim Graham <timograham@…>, 6 years ago

In 91a02dce:

[2.1.x] Fixed #29464 -- Silenced post-process messages in collectstatic's default verbosity.

Backport of bc1435551c0cfaf4a22aff8216990b909005dba9 from master

Note: See TracTickets for help on using tickets.
Back to Top