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

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

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

Uploaded Source

Built Distribution

pytest_django_docker_pg-0.0.5-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file pytest_django_docker_pg-0.0.5.tar.gz.

File metadata

  • Download URL: pytest_django_docker_pg-0.0.5.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.4

File hashes

Hashes for pytest_django_docker_pg-0.0.5.tar.gz
Algorithm Hash digest
SHA256 04170084e4dfca234a691054184150757b9f0d9feb50e615b863ac81c8e37cdd
MD5 44be8b8085c01a80b46a7b8a82784da5
BLAKE2b-256 4a20520e40e3755c451f3e0d85375f3547f260b00b76d0bca91f8996f1a6566f

See more details on using hashes here.

File details

Details for the file pytest_django_docker_pg-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_django_docker_pg-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 79aa49e12a28a7629b86396cf5470664fa7e0e5a92b463b104c7cfa9fde8a12a
MD5 7a0a26fb3d5a83d2a475f8a085ae2ef2
BLAKE2b-256 98e4765dcebe6a336a803d1b8b67d94ae3d283d16d63481744ad4bbc648e6ffb

See more details on using hashes here.

Supported by

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