#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 roebk):
For a little guidance and to ensure I implement the tests in the best
possible way, what would be the best way in adding the test for a missing
target directory? Should I be looking at adding a new class something
along the lines of TestCollectionClearNoTargetDirectory?
For reference the current test of the ``--clear`` option is as follows:
{{{
class TestCollectionClear(CollectionTestCase):
"""
Test the ``--clear`` option of the ``collectstatic`` management
command.
"""
def run_collectstatic(self, **kwargs):
clear_filepath = os.path.join(settings.STATIC_ROOT, 'cleared.txt')
with open(clear_filepath, 'w') as f:
f.write('should be cleared')
super(TestCollectionClear, self).run_collectstatic(clear=True)
def test_cleared_not_found(self):
self.assertFileNotFound('cleared.txt')
}}}
Thanks in advance :)
--
Ticket URL: <https://code.djangoproject.com/ticket/23986#comment:6>
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.f50a4242e2546a663ad579ce665367aa%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.