diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2011-10-16 14:30:43 +0000 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2011-10-16 14:30:43 +0000 |
| commit | b7f2aba56608fc65843abf50d1c1cc32af533a72 (patch) | |
| tree | a4d2f817f22443f38a129e90565d8cac9e950b53 | |
| parent | 8fb7a9002669fb7ba7bec7df90b465b92e1ed3c2 (diff) | |
Fixed a test that relied on the database to reject invalid data; MySQL doesn't. Refs #17055.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16996 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | tests/modeltests/fixtures/tests.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/modeltests/fixtures/tests.py b/tests/modeltests/fixtures/tests.py index 54ce4708e6..16c5bfe0d7 100644 --- a/tests/modeltests/fixtures/tests.py +++ b/tests/modeltests/fixtures/tests.py @@ -4,6 +4,7 @@ import StringIO from django.contrib.sites.models import Site from django.core import management +from django.db import connection from django.test import TestCase, TransactionTestCase, skipUnlessDBFeature from .models import Article, Book, Spy, Tag, Visa @@ -260,6 +261,11 @@ class FixtureLoadingTests(TestCase): outputs an error message which contains the pk of the object that triggered the error. """ + # MySQL needs a little prodding to reject invalid data. + # This won't affect other tests because the database connection + # is closed at the end of each test. + if connection.vendor == 'mysql': + connection.cursor().execute("SET sql_mode = 'TRADITIONAL'") new_io = StringIO.StringIO() management.call_command('loaddata', 'invalid.json', verbosity=0, stderr=new_io, commit=False) output = new_io.getvalue().strip().split('\n') |
