pytest-django-docker-pg 0.0.5

Last updated:

0 purchases

pytest-django-docker-pg 0.0.5 Image
pytest-django-docker-pg 0.0.5 Images
Add to Cart

Description:

pytestdjangodockerpg 0.0.5

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

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.