1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Fixed isolation of FeaturesTests.test_supports_json_field_operational_error().

This commit is contained in:
Mariusz Felisiak 2022-03-18 20:56:10 +01:00
parent fbacaa58ff
commit ed6db53542

View File

@ -10,8 +10,9 @@ class FeaturesTests(TestCase):
if hasattr(connection.features, "supports_json_field"): if hasattr(connection.features, "supports_json_field"):
del connection.features.supports_json_field del connection.features.supports_json_field
msg = "unable to open database file" msg = "unable to open database file"
with mock.patch( with mock.patch.object(
"django.db.backends.base.base.BaseDatabaseWrapper.cursor", connection,
"cursor",
side_effect=OperationalError(msg), side_effect=OperationalError(msg),
): ):
with self.assertRaisesMessage(OperationalError, msg): with self.assertRaisesMessage(OperationalError, msg):