mirror of
https://github.com/django/django.git
synced 2025-08-02 10:02:41 +00:00
Fixed #32224 -- Avoided suppressing connection errors in supports_json_field on SQLite.`
Regression in 6789ded0a6
.
Thanks Juan Garcia Alvite for the report.
This commit is contained in:
parent
b996424199
commit
f5e5aac59e
3 changed files with 28 additions and 5 deletions
18
tests/backends/sqlite/test_features.py
Normal file
18
tests/backends/sqlite/test_features.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
from unittest import mock, skipUnless
|
||||
|
||||
from django.db import OperationalError, connection
|
||||
from django.test import TestCase
|
||||
|
||||
|
||||
@skipUnless(connection.vendor == 'sqlite', 'SQLite tests.')
|
||||
class FeaturesTests(TestCase):
|
||||
def test_supports_json_field_operational_error(self):
|
||||
if hasattr(connection.features, 'supports_json_field'):
|
||||
del connection.features.supports_json_field
|
||||
msg = 'unable to open database file'
|
||||
with mock.patch(
|
||||
'django.db.backends.base.base.BaseDatabaseWrapper.cursor',
|
||||
side_effect=OperationalError(msg),
|
||||
):
|
||||
with self.assertRaisesMessage(OperationalError, msg):
|
||||
connection.features.supports_json_field
|
Loading…
Add table
Add a link
Reference in a new issue