From 21e686471598d6c755d93a570de20dc00d8d27f6 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Wed, 28 Jun 2023 12:11:25 +0200 Subject: [PATCH] Fixed RecorderTests.test_has_table_cached() on databases that perform multiple queries when introspecting tables. Thanks Tim Graham for the report and implementation idea. Follow up to ea8cbca579cc6742e119747fc1eb6ecf90638bce. --- tests/migrations/test_loader.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/migrations/test_loader.py b/tests/migrations/test_loader.py index 24e1e98c19..3b30aed100 100644 --- a/tests/migrations/test_loader.py +++ b/tests/migrations/test_loader.py @@ -54,9 +54,9 @@ class RecorderTests(TestCase): query for the existence of the migrations table. """ recorder = MigrationRecorder(connection) - with self.assertNumQueries(1): - self.assertEqual(recorder.has_table(), True) - self.assertEqual(recorder.has_table(), True) + self.assertIs(recorder.has_table(), True) + with self.assertNumQueries(0): + self.assertIs(recorder.has_table(), True) class LoaderTests(TestCase):