Skip to content
Snippets Groups Projects
Commit 875f9024 authored by Chris Lamb's avatar Chris Lamb :eyes:
Browse files

Fix compatibility with SQLite 3.37+. (Closes: #1004464)

parent 76f04f1d
No related branches found
No related tags found
No related merge requests found
From: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Date: Thu, 9 Dec 2021 13:21:36 +0100
Subject: Fixed inspectdb.tests.InspectDBTestCase.test_custom_fields() on
SQLite 3.37+.
Use FlexibleFieldLookupDict which is case-insensitive mapping because
SQLite 3.37+ returns some data type names uppercased e.g. TEXT.
---
tests/inspectdb/tests.py | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/tests/inspectdb/tests.py b/tests/inspectdb/tests.py
index a0c4aff2e5af..8ef757fc18ef 100644
--- a/tests/inspectdb/tests.py
+++ b/tests/inspectdb/tests.py
@@ -302,18 +302,17 @@ class InspectDBTestCase(TestCase):
Introspection of columns with a custom field (#21090)
"""
out = StringIO()
- orig_data_types_reverse = connection.introspection.data_types_reverse
- try:
- connection.introspection.data_types_reverse = {
+ with mock.patch(
+ 'django.db.connection.introspection.data_types_reverse.base_data_types_reverse',
+ {
'text': 'myfields.TextField',
'bigint': 'BigIntegerField',
- }
+ },
+ ):
call_command('inspectdb', 'inspectdb_columntypes', stdout=out)
output = out.getvalue()
self.assertIn("text_field = myfields.TextField()", output)
self.assertIn("big_int_field = models.BigIntegerField()", output)
- finally:
- connection.introspection.data_types_reverse = orig_data_types_reverse
def test_introspection_errors(self):
"""
......@@ -7,3 +7,4 @@
0007-Refs-32786-Made-Query.clear_ordering-not-to-cause-si.patch
0008-Refs-32690-Altered-lookups-Query-rhs-alterations-dur.patch
0009-Fixed-33282-Fixed-a-crash-when-OR-ing-subquery-and-a.patch
0010-Fixed-inspectdb.tests.InspectDBTestCase.test_custom_.patch
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment