summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2018-06-06 11:25:05 -0400
committerTim Graham <timograham@gmail.com>2018-06-06 11:31:39 -0400
commit60aa235f43cce05ddda439993a3db3ee2e5cb602 (patch)
treeafc7793970111011074cda56e09cff6161ad099f
parent7434ac4624b4b07a076cc56d220a4991a38e5100 (diff)
[2.1.x] Fixed MySQL QuerySet.explain() test when running tests in reverse.
Backport of 13fe5a87f9554a6371f1d0914887bffcdf978a8a from master
-rw-r--r--tests/queries/test_explain.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/queries/test_explain.py b/tests/queries/test_explain.py
index 26baf6fb30..ad4ca988ee 100644
--- a/tests/queries/test_explain.py
+++ b/tests/queries/test_explain.py
@@ -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)