diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2011-01-18 16:43:01 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2011-01-18 16:43:01 +0000 |
| commit | b31a1b99261d05bf8a34495ee9faf4d6592b8b36 (patch) | |
| tree | f4064ac0d7e287596458823a67e7f75ea0ddd444 /docs/topics | |
| parent | 5502fa59801c70094b6a2e789ece65aa7b31b58c (diff) | |
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
Diffstat (limited to 'docs/topics')
| -rw-r--r-- | docs/topics/testing.txt | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/topics/testing.txt b/docs/topics/testing.txt index 78590ddb2b..795f041fb9 100644 --- a/docs/topics/testing.txt +++ b/docs/topics/testing.txt @@ -1237,6 +1237,15 @@ documentation<dumpdata>` for more details. Fixtures with other names can always be installed manually using the :djadmin:`manage.py loaddata<loaddata>` command. +.. admonition:: Initial SQL data and testing + + Django provides a second way to insert initial data into models -- + the :ref:`custom SQL hook <initial-sql>`. However, 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. + Once you've created a fixture and placed it in a ``fixtures`` directory in one of your :setting:`INSTALLED_APPS`, you can use it in your unit tests by specifying a ``fixtures`` class attribute on your :class:`django.test.TestCase` |
