Refs #14661 -- Clarified the handling of initial data injected via custom SQL.

This is BACKWARDS INCOMPATIBLE CHANGE for anyone relying on SQL-injected initial data in a test case.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15239 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2011-01-18 16:43:01 +00:00
parent 5502fa5980
commit b31a1b9926
7 changed files with 81 additions and 6 deletions

View file

@ -121,6 +121,17 @@ the order in which they're executed. The only thing you can assume is
that, by the time your custom data files are executed, all the
database tables already will have been created.
.. admonition:: Initial SQL data and testing
This technique *cannot* be used to provide initial data for
testing purposes. Django's test framework flushes the contents of
the test database after each test; as a result, any data added
using the custom SQL hook will be lost.
If you require data for a test case, you should add it using
either a :ref:`test fixture <topics-testing-fixtures>`, or
programatically add it during the ``setUp()`` of your test case.
Database-backend-specific SQL data
----------------------------------