Skip to main content

Configure an in-memory database for running Django tests

Project description

Use a pure in-memory database for running Django tests.

Usage

In settings.py:

from fast_test_database import fast_test_database

DATABASES = fast_test_database(DATABASES)

# Or:
DATABASES = fast_test_database(DATABASES,
                               test_commands=('test', 'harvest'))

# Or:
DATABASES = fast_test_database(DATABASES,
                               version='5.7')

This will be a no-op except for ./manage.py test, when an in-memory database will be automatically started and supplied to the application.

Details

The in-memory database is a full PostgreSQL or MySQL instance started using Docker, using tmpfs for storing the data. A single container will be started if not yet running. It will not be shut down automatically, and instead reused for subsequent tests.

The type of the database (PostgreSQL or MySQL) is chosen based on the existing default database engine.

The default version of the database (PostgreSQL or MySQL) is latest. But it can be specified by version parameter.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fast_test_database-1.0.4.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fast_test_database-1.0.4-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file fast_test_database-1.0.4.tar.gz.

File metadata

  • Download URL: fast_test_database-1.0.4.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for fast_test_database-1.0.4.tar.gz
Algorithm Hash digest
SHA256 20ccc8f28e500c38b4aedf25d6b37cb22dab18a3ad8ac3fba6ed0a312530ecf4
MD5 ffcccfb31d17a81ca8f54054428dedce
BLAKE2b-256 e2da1a73874fb133c430c3935b022ec5c59063b7b7c5468cca3304e6e5b4287c

See more details on using hashes here.

File details

Details for the file fast_test_database-1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for fast_test_database-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 423a55b7caae1dfc1a03e77dee0278a2138d55ef0c76bca5fb2b43f22e05b1e1
MD5 14e8c4e9474194f79b0a7c41fbf9c1c7
BLAKE2b-256 65da27e1ec22c1cbf1aa3c3d80724ba25c85b0b6813962867150dcf84d4259c0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page