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

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

parent 9d56a1a9
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 8be168110613..6729e7f837bb 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):
"""
......@@ -2,3 +2,4 @@
0002-use_debian_geoip_database_as_default.diff
0004-Use-locally-installed-documentation-sources.patch
0004-Set-the-default-shebang-to-new-projects-to-use-Pytho.patch
0005-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