diff options
| author | Tim Graham <timograham@gmail.com> | 2019-01-28 11:14:45 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2019-01-28 11:21:47 -0500 |
| commit | d3b4f4b9629f24a59082b74559d131dde592f9f7 (patch) | |
| tree | f30f9752b34fd829695aef0ee8023d2b16607bde /tests/backends/sqlite | |
| parent | e8cb0dcc19c4bcabee1d856b7fae1b54fa3e3380 (diff) | |
[2.2.x] Refs #30055 -- Added a helpful error when SQLite is too old.
Backport of 7444f3252757ed4384623e5afd7dcfeef3e0c74e from master.
Diffstat (limited to 'tests/backends/sqlite')
| -rw-r--r-- | tests/backends/sqlite/tests.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/backends/sqlite/tests.py b/tests/backends/sqlite/tests.py index c681d39775..e53d453ed5 100644 --- a/tests/backends/sqlite/tests.py +++ b/tests/backends/sqlite/tests.py @@ -1,8 +1,12 @@ import re import threading import unittest +from sqlite3 import dbapi2 +from unittest import mock +from django.core.exceptions import ImproperlyConfigured from django.db import connection, transaction +from django.db.backends.sqlite3.base import check_sqlite_version from django.db.models import Avg, StdDev, Sum, Variance from django.db.models.aggregates import Aggregate from django.db.models.fields import CharField @@ -19,6 +23,13 @@ from ..models import Author, Item, Object, Square class Tests(TestCase): longMessage = True + def test_check_sqlite_version(self): + msg = 'SQLite 3.8.3 or later is required (found 3.8.2).' + with mock.patch.object(dbapi2, 'sqlite_version_info', (3, 8, 2)), \ + mock.patch.object(dbapi2, 'sqlite_version', '3.8.2'), \ + self.assertRaisesMessage(ImproperlyConfigured, msg): + check_sqlite_version() + def test_aggregation(self): """ Raise NotImplementedError when aggregating on date/time fields (#19360). |
