File: settings_sqlite_file.py

package info (click to toggle)
pytest-django 4.11.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 604 kB
  • sloc: python: 4,006; makefile: 39; sh: 17
file content (37 lines) | stat: -rw-r--r-- 1,043 bytes parent folder | download
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,
        },
    },
}