Fixes tests for Django 1.7 & MySQL.

This commit is contained in:
Bertrand Bordage 2014-10-21 23:49:26 +02:00
parent e276d3961c
commit 5a4f0a4f7a

View file

@ -554,6 +554,11 @@ class DatabaseCommandTestCase(TransactionTestCase):
call_command('flush', verbosity=0, interactive=False)
if django_version >= (1, 7) and connection.vendor == 'mysql':
# We need to reopen the connection or Django
# will execute an extra SQL request below.
connection.cursor()
with self.assertNumQueries(1):
self.assertListEqual(list(Test.objects.all()), [])
@ -564,6 +569,11 @@ class DatabaseCommandTestCase(TransactionTestCase):
call_command('loaddata', 'cachalot/tests/loaddata_fixture.json',
verbosity=0, interactive=False)
if django_version >= (1, 7) and connection.vendor == 'mysql':
# We need to reopen the connection or Django
# will execute an extra SQL request below.
connection.cursor()
with self.assertNumQueries(1):
self.assertListEqual([t.name for t in Test.objects.all()],
['test1', 'test2'])