Fixed MySQL QuerySet.explain() test when running tests in reverse.

This commit is contained in:
Tim Graham 2018-06-06 11:25:05 -04:00
parent c4f099de1d
commit 13fe5a87f9
1 changed files with 3 additions and 0 deletions

View File

@ -69,6 +69,9 @@ class ExplainTests(TestCase):
@unittest.skipUnless(connection.vendor == 'mysql', 'MySQL specific')
def test_mysql_text_to_traditional(self):
# Initialize the cached property, if needed, to prevent a query for
# the MySQL version during the QuerySet evaluation.
connection.features.needs_explain_extended
with CaptureQueriesContext(connection) as captured_queries:
Tag.objects.filter(name='test').explain(format='text')
self.assertEqual(len(captured_queries), 1)