1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
import tempfile
from .settings_base import * # noqa: F403
# This is a SQLite configuration, which uses a file based database for
# tests (via setting TEST_NAME / TEST['NAME']).
# The name as expected / used by Django/pytest_django (tests/db_helpers.py).
_fd, _filename_default = tempfile.mkstemp(prefix="test_")
_fd, _filename_replica = tempfile.mkstemp(prefix="test_")
_fd, _filename_second = tempfile.mkstemp(prefix="test_")
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": "/pytest_django_tests_default",
"TEST": {
"NAME": _filename_default,
},
},
"replica": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": "/pytest_django_tests_replica",
"TEST": {
"MIRROR": "default",
"NAME": _filename_replica,
},
},
"second": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": "/pytest_django_tests_second",
"TEST": {
"NAME": _filename_second,
},
},
}
|