Skip to content

Commit

Permalink
Fixes tests for Django 1.7 & MySQL.
Browse files Browse the repository at this point in the history
  • Loading branch information
BertrandBordage committed Oct 21, 2014
1 parent e276d39 commit 5a4f0a4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cachalot/tests/write.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,11 @@ def test_flush(self):

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()), [])

Expand All @@ -564,6 +569,11 @@ def test_loaddata(self):
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'])

0 comments on commit 5a4f0a4

Please sign in to comment.