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.2.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.2-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for fast_test_database-1.0.2.tar.gz
Algorithm Hash digest
SHA256 2eda348864b895b9f5f0ee45d62613d8f43ad46c83cee292d558730f76f91d01
MD5 5cd62c9246aeb72a99880b840b19286c
BLAKE2b-256 c6b4158109d092d2b06a30a75f0c6ff1e9277bfc7f00741de10607f9c8aed1a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fast_test_database-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b98f7338da13a87df4d16b8b319ab1b8ebe2c5f758e2bdcc2906ca6dbe302d01
MD5 0a555323e6be501d9c2b202dc9dba409
BLAKE2b-256 a4fb9ac87949eab91295427c50b3dba8fb514df23a2288ba1555bf2736eca7b6

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