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

Split staticfiles tests in multiple files #3977

Closed
wants to merge 1 commit into from

Conversation

diegoguimaraes
Copy link
Contributor

I made this pull request based on a suggestion made by @timgraham, to improve the structure of the staticfiles test files.

This PR split the tests.py file in multiple files according its scope. Follow the suggested structure:

test_base.py

BaseStaticFilesTestCase(object)
StaticFilesTestCase(BaseStaticFilesTestCase, TestCase)
BaseCollectionTestCase(BaseStaticFilesTestCase)
CollectionTestCase(BaseCollectionTestCase, StaticFilesTestCase)
TestDefaults(object)
TestHashedFiles(object)

test_collections.py

TestFindStatic(CollectionTestCase, TestDefaults)
TestCollection(CollectionTestCase, TestDefaults)
TestCollectionClear(CollectionTestCase)
TestCollectionExcludeNoDefaultIgnore(CollectionTestCase, TestDefaults)
TestNoFilesCreated(object)
TestCollectionDryRun(CollectionTestCase, TestNoFilesCreated)
TestCollectionFilesOverride(CollectionTestCase)
TestCollectionNonLocalStorage(CollectionTestCase, TestNoFilesCreated)
TestCollectionCachedStorage(TestHashedFiles, BaseCollectionTestCase, BaseStaticFilesTestCase, TestCase)
TestCollectionManifestStorage(TestHashedFiles, BaseCollectionTestCase, BaseStaticFilesTestCase, TestCase)
TestCollectionSimpleCachedStorage(BaseCollectionTestCase, BaseStaticFilesTestCase, TestCase)
TestCollectionLinks(CollectionTestCase, TestDefaults)

test_liveserver.py

LiveServerBase(StaticLiveServerTestCase)
StaticLiveServerChecks(LiveServerBase)
StaticLiveServerView(LiveServerBase)

tests.py

TestConfiguration(StaticFilesTestCase)
TestTemplateTag(StaticFilesTestCase)
CustomStaticFilesStorage(storage.StaticFilesStorage)
TestStaticFilePermissions(BaseCollectionTestCase, StaticFilesTestCase)

test_serve.py

TestServeStatic(StaticFilesTestCase)
TestServeDisabled(TestServeStatic)
TestServeStaticWithDefaultURL(TestServeStatic, TestDefaults)
TestServeStaticWithURLHelper(TestServeStatic, TestDefaults)
TestServeAdminMedia(TestServeStatic)

test_finder.py

FinderTestCase(object)
TestFileSystemFinder(StaticFilesTestCase, FinderTestCase)
TestAppDirectoriesFinder(StaticFilesTestCase, FinderTestCase)
TestDefaultStorageFinder(StaticFilesTestCase, FinderTestCase)
TestMiscFinder(TestCase)

Improve staticfiles test files structure.
@timgraham
Copy link
Member

Thanks for this. It needs a rebase at this point. As far as the file names go, I'd try to take inspiration from how the contrib.auth tests are laid out and use filenames like test_<module>.py

@diegoguimaraes
Copy link
Contributor Author

I'll take a look at contrib.tests and try use them as inspiration to name the staticfiles test files.
Thanks.

@timgraham
Copy link
Member

Please send a new PR if you can update this, thanks!

@timgraham timgraham closed this Mar 26, 2015
@diegoguimaraes diegoguimaraes deleted the staticfiles branch July 13, 2015 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants