summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/inspectdb/tests.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/inspectdb/tests.py b/tests/inspectdb/tests.py
index a0c4aff2e5..8ef757fc18 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):
"""