diff options
author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-12-09 20:24:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-09 20:24:38 +0100 |
commit | 974e3b8750fe96c16c9c0b115a72ee4a2171df34 (patch) | |
tree | d79f3c26656d2aafc757e29ad3f2a45103c7e8ac /tests/inspectdb | |
parent | 17df72114e222d63c2af9ed9780583f4cb0689eb (diff) | |
download | django-974e3b8750fe96c16c9c0b115a72ee4a2171df34.tar.gz |
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.
Diffstat (limited to 'tests/inspectdb')
-rw-r--r-- | tests/inspectdb/tests.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/inspectdb/tests.py b/tests/inspectdb/tests.py index 1deffff140..20da7ade4d 100644 --- a/tests/inspectdb/tests.py +++ b/tests/inspectdb/tests.py @@ -312,18 +312,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): """ |