Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #27854 -- Added system check for nonexistent directories in STATICFILES_DIRS setting. #14056

Merged
merged 3 commits into from Mar 3, 2021

Conversation

jacobtylerwalls
Copy link
Member

Copy link
Member

@felixxm felixxm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jacobtylerwalls Thanks 👍

docs/ref/checks.txt Outdated Show resolved Hide resolved
docs/ref/checks.txt Outdated Show resolved Hide resolved
django/contrib/staticfiles/finders.py Outdated Show resolved Hide resolved
django/contrib/staticfiles/finders.py Outdated Show resolved Hide resolved
@jacobtylerwalls jacobtylerwalls force-pushed the ticket-27854 branch 2 times, most recently from 84aab66 to c9c8edd Compare March 1, 2021 13:44
@jacobtylerwalls jacobtylerwalls force-pushed the ticket-27854 branch 2 times, most recently from 5c6a7ee to 37debdd Compare March 1, 2021 14:48
Copy link
Member

@felixxm felixxm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jacobtylerwalls Thanks for updates 👍

I reorganized commits, added a small cleanup with using CollectionTestCase in FindersCheckTests tests, and pushed minor edits.

Warning(
'The directory /fake/path in the STATICFILES_DIRS setting does not exist.',
id='staticfiles.W004',
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't mix a new check with existing tests. I would move it to a separate method.

Comment on lines 54 to 59
@override_settings(STATICFILES_DIRS=container_for_tempdir)
def test_no_errors_with_provided_directory(self):
with tempfile.TemporaryDirectory() as tmpdirname:
self.container_for_tempdir.append(tmpdirname)
self.assertEqual(check_finders(None), [])

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is redundant with test_no_errors_with_test_settings because CollectionTestCase uses existing directories.

@felixxm felixxm changed the title Fixed #27854 -- Warned when a missing directory detected in STATICFILES_DIRS. Fixed #27854 -- Added system check for nonexistent directories in STATICFILES_DIRS setting. Mar 3, 2021
Copy link
Member

@carltongibson carltongibson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, yes, no problem, super, thanks all.


class FindersCheckTests(SimpleTestCase):

class FindersCheckTests(CollectionTestCase):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using CollectionTestCase gives us existing directories in "static" settings.

@felixxm felixxm merged commit b23232b into django:master Mar 3, 2021
@jacobtylerwalls jacobtylerwalls deleted the ticket-27854 branch March 3, 2021 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants