diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-11-25 12:19:45 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-25 12:19:45 +0100 |
| commit | f5e5aac59ebbcea46b98d37834915de0f43d7cc8 (patch) | |
| tree | 69984f50fddece7d6c443cee1b867e40754ee1d5 /tests/backends/sqlite | |
| parent | b996424199cca58f64b77faeaa367b7e7efb9776 (diff) | |
Fixed #32224 -- Avoided suppressing connection errors in supports_json_field on SQLite.`
Regression in 6789ded0a6ab797f0dcdfa6ad5d1cfa46e23abcd.
Thanks Juan Garcia Alvite for the report.
Diffstat (limited to 'tests/backends/sqlite')
| -rw-r--r-- | tests/backends/sqlite/test_features.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/backends/sqlite/test_features.py b/tests/backends/sqlite/test_features.py new file mode 100644 index 0000000000..9b74794408 --- /dev/null +++ b/tests/backends/sqlite/test_features.py @@ -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 |
