summaryrefslogtreecommitdiff
path: root/tests/backends
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2019-01-28 11:14:45 -0500
committerGitHub <noreply@github.com>2019-01-28 11:14:45 -0500
commit7444f3252757ed4384623e5afd7dcfeef3e0c74e (patch)
tree59ec331cba19bf29ae00897878962e82d9f594d4 /tests/backends
parentfcfb7306586184f08c7f75c174f95b54a212320d (diff)
downloaddjango-7444f3252757ed4384623e5afd7dcfeef3e0c74e.tar.gz
Refs #30055 -- Added a helpful error when SQLite is too old.
Diffstat (limited to 'tests/backends')
-rw-r--r--tests/backends/sqlite/tests.py11
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).