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 /tests/regressiontests/initial_sql_regress | |
| 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 'tests/regressiontests/initial_sql_regress')
| -rw-r--r-- | tests/regressiontests/initial_sql_regress/models.py | 2 | ||||
| -rw-r--r-- | tests/regressiontests/initial_sql_regress/tests.py | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/tests/regressiontests/initial_sql_regress/models.py b/tests/regressiontests/initial_sql_regress/models.py index 9f91802ec7..6c7db2f362 100644 --- a/tests/regressiontests/initial_sql_regress/models.py +++ b/tests/regressiontests/initial_sql_regress/models.py @@ -7,5 +7,3 @@ from django.db import models class Simple(models.Model): name = models.CharField(max_length = 50) -# NOTE: The format of the included SQL file for this test suite is important. -# It must end with a trailing newline in order to test the fix for #2161. diff --git a/tests/regressiontests/initial_sql_regress/tests.py b/tests/regressiontests/initial_sql_regress/tests.py index 2b3ca91f91..1e6710be9e 100644 --- a/tests/regressiontests/initial_sql_regress/tests.py +++ b/tests/regressiontests/initial_sql_regress/tests.py @@ -5,4 +5,11 @@ from models import Simple class InitialSQLTests(TestCase): def test_initial_sql(self): - self.assertEqual(Simple.objects.count(), 7) + # The format of the included SQL file for this test suite is important. + # It must end with a trailing newline in order to test the fix for #2161. + + # However, as pointed out by #14661, test data loaded by custom SQL + # can't be relied upon; as a result, the test framework flushes the + # data contents before every test. This test validates that this has + # occurred. + self.assertEqual(Simple.objects.count(), 0) |
