1
0
mirror of https://github.com/django/django.git synced 2025-07-04 09:49:12 +00:00

[3.2.x] 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 upper-cased e.g. TEXT.
Backport of 974e3b8750fe96c16c9c0b115a72ee4a2171df34 from main
This commit is contained in:
Mariusz Felisiak 2021-12-09 20:24:38 +01:00
parent 4c2b26174f
commit 9da46345d8

View File

@ -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):
"""