1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

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 ea8cbca579.
This commit is contained in:
Mariusz Felisiak 2023-06-28 12:11:25 +02:00 committed by GitHub
parent 1dbcf9a005
commit 21e6864715
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,9 +54,9 @@ class RecorderTests(TestCase):
query for the existence of the migrations table. query for the existence of the migrations table.
""" """
recorder = MigrationRecorder(connection) recorder = MigrationRecorder(connection)
with self.assertNumQueries(1): self.assertIs(recorder.has_table(), True)
self.assertEqual(recorder.has_table(), True) with self.assertNumQueries(0):
self.assertEqual(recorder.has_table(), True) self.assertIs(recorder.has_table(), True)
class LoaderTests(TestCase): class LoaderTests(TestCase):