#23986: Collectstatic --clear fails if the static dir doesn't exist yet
-------------------------------------+------------------------------------
Reporter: mvantellingen | Owner: roebk
Type: Bug | Status: assigned
Component: contrib.staticfiles | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-------------------------------------+------------------------------------
Comment (by berkerpeksag):
You can just override the `STATIC_ROOT` setting and call
`self.run_collectstatic()`:
{{{#!py
@override_settings(STATIC_ROOT=os.path.join(TEST_ROOT, 'project',
'site_media', 'static-does-not-exist'))
def test_empty_directory(self):
self.run_collectstatic()
}}}
but, I think this is not the cleanest solution. You also don't need to
call `BaseCollectionTestCase.setUp()` because it tries to create a
directory if it doesn't exist:
https://github.com/django/django/blob/master/tests/staticfiles_tests/tests.py#L132
I'd go with a new test case (without using `BaseCollectionTestCase`
mixin).
--
Ticket URL: <https://code.djangoproject.com/ticket/23986#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/071.1119175e62d03c69b76e2437432b5bdf%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.