summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTom Forbes <tom@tomforb.es>2023-05-23 18:05:31 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-05-25 13:18:02 +0200
commitea8cbca579cc6742e119747fc1eb6ecf90638bce (patch)
treeb79d3204287a0400d3be4d7b17abc8106465df19 /tests
parent9d756afb07de8ef6e4d1980413979496643f1c3b (diff)
Made MigrationRecorder cache has_table() result if django_migrations table exists.
Diffstat (limited to 'tests')
-rw-r--r--tests/migrations/test_loader.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/migrations/test_loader.py b/tests/migrations/test_loader.py
index 800d715bc9..24e1e98c19 100644
--- a/tests/migrations/test_loader.py
+++ b/tests/migrations/test_loader.py
@@ -48,6 +48,16 @@ class RecorderTests(TestCase):
set(),
)
+ def test_has_table_cached(self):
+ """
+ The has_table() method caches a positive result and not continually
+ 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)
+
class LoaderTests(TestCase):
"""