Skip to main content

No project description provided

Project description

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"),
    }
}

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

pytest_django_docker_pg-0.0.2.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

pytest_django_docker_pg-0.0.2-py3-none-any.whl (5.7 kB view hashes)

Uploaded Python 3

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