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-0.2.9.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: fast_test_database-0.2.9.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for fast_test_database-0.2.9.tar.gz
Algorithm Hash digest
SHA256 72bf2f03f21488c66512b5e58f8890ae986d96f94c40b2339a565b1d7a581873
MD5 e7e16e804c34c91dd0699d6dac8c009d
BLAKE2b-256 392d6d381cf38e9d5935d2ce84e7d72b2e88523c698ccca2a989a01c380a61f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fast_test_database-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 f8483683d4f0ef0bde761549f80e383ae493436fe3e3944217a46958b4c29001
MD5 a929a72bce5c72c6c541e91eceb56b41
BLAKE2b-256 71e8536d6a73ddf4e8fa4b0fc77397b3c005dc3817cbdd9c104db9f76d32d191

See more details on using hashes here.

Supported by

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