Opened 15 years ago

Closed 15 years ago

#5608 closed (wontfix)

Allow loading test data fixtures before running tests

Reported by: eikke@… 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


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, which will be loaded into the test database once it is created.

TEST_FIXTURES = ('test_data', )

Attachments (1)

0001-Implement-TEST_FIXTURES-feature.patch (3.3 KB) - added by eikke@… 15 years ago.
Implement TEST_FIXTURES functionality

Download all attachments as: .zip

Change History (2)

Changed 15 years ago by eikke@…

Implement TEST_FIXTURES functionality

comment:1 Changed 15 years ago by Russell Keith-Magee

Patch needs improvement: set
Resolution: wontfix
Status: newclosed

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.

Note: See TracTickets for help on using tickets.
Back to Top