Opened 17 years ago
Closed 17 years ago
#5608 closed (wontfix)
Allow loading test data fixtures before running tests
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Testing framework | Version: | dev |
Severity: | Keywords: | test fixtures | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
When using doctests as testing framework within a Django application it can be annoying no initial data is available in the database. One could use the initial_data fixture to preload some data, but this is not ideal in a production environment, as you don't want any test data in your production database, whilst you might still want to ship some initial_data which should also be loaded when initializing the application.
This results in a need to define fixtures to be loaded in the test database before the tests are started. Attached patch provides this functionality: it allows to set a TEST_FIXTURES tuple in settings.py, which will be loaded into the test database once it is created.
Eg:
TEST_FIXTURES = ('test_data', )
Attachments (1)
Change History (2)
by , 17 years ago
Attachment: | 0001-Implement-TEST_FIXTURES-feature.patch added |
---|
comment:1 by , 17 years ago
Patch needs improvement: | set |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
I acknowledge that doctests cannot use fixtures as easily as unit tests can; however, the solution isn't to create a global test fixture. Test fixtures are (or should be) very specific to tests, not a generic item with global applicability.
The solution to this problem is to simplify the process of defining fixtures on a per-doctest basis, not define a global test fixture. In the interim, doctest fixtures aren't *that* hard to set up manually using calls to management.call_command.
Implement TEST_FIXTURES functionality