Skip to content

Commit

Permalink
[3.2.x] Fixed inspectdb.tests.InspectDBTestCase.test_custom_fields() …
Browse files Browse the repository at this point in the history
…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 974e3b8 from main
  • Loading branch information
felixxm committed Jan 31, 2023
1 parent 4c2b261 commit 9da4634
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tests/inspectdb/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,18 302,17 @@ def test_custom_fields(self):
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):
"""
Expand Down

0 comments on commit 9da4634

Please sign in to comment.