Skip to main content

pytest-django-docker-pg

Starts a dockerized postgresql instance in pytest hook allowing pytest_django tests, for example, to be run against it.

How to use

[tool.pytest.ini_options]
addopts = "-p pytest_django_docker_pg --django-docker-pg-image=postgres:16-alpine "
# settings.py

import os 

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.postgresql",
        "NAME": os.getenv("DB_NAME", "postgres"),
        "USER": os.getenv("DB_USER", "postgres"),
        "PASSWORD": os.getenv("DB_PASSWORD", "secret"),
        "HOST": os.getenv("DB_HOST", "localhost"),
        "PORT": os.getenv("DB_PORT", "5432"),
    }
}

The default timeout to start a postgres container is 30 seconds. Can be adjusted in the PYTEST_DJANGO_DOCKER_PG_CONTAINER_TIMEOUT environment variable

Metadata

Release files for pytest-django-docker-pg 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-django-docker-pg 0.0.5
File Size Uploaded
pytest_django_docker_pg-0.0.5.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-django-docker-pg 0.0.5
File Interpreter ABI Platform
pytest_django_docker_pg-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 kB

Release files / pytest_django_docker_pg-0.0.5.tar.gz

Download URL pytest_django_docker_pg-0.0.5.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
04170084e4dfca234a691054184150757b9f0d9feb50e615b863ac81c8e37cdd
BLAKE2b-256 checksum
How to use checksums
4a20520e40e3755c451f3e0d85375f3547f260b00b76d0bca91f8996f1a6566f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.4

Release files / pytest_django_docker_pg-0.0.5-py3-none-any.whl

Download URL pytest_django_docker_pg-0.0.5-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
79aa49e12a28a7629b86396cf5470664fa7e0e5a92b463b104c7cfa9fde8a12a
BLAKE2b-256 checksum
How to use checksums
98e4765dcebe6a336a803d1b8b67d94ae3d283d16d63481744ad4bbc648e6ffb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page