Code

Opened 7 years ago

Closed 7 years ago

#5608 closed (wontfix)

Allow loading test data fixtures before running tests

Reported by: eikke@… Owned by: nobody
Component: Testing framework Version: master
Severity: Keywords: test fixtures
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:

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)

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

Download all attachments as: .zip

Change History (2)

Changed 7 years ago by eikke@…

Implement TEST_FIXTURES functionality

comment:1 Changed 7 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement set
  • Resolution set to wontfix
  • Status changed from new to 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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.