Skip to main content

Use a temporary PostgreSQL database with pytest-django

Project description

Use case

This pytest plugin can be used to test a Django application that uses PostgreSQL. It leverages the testing.postgresql module to setup a temporary PostgreSQL database server and injects the configuration for it into Django’s settings. It is intended to be used together with pytest-django.

Requirements

testing.postgresql needs the postgresql server binary available.

How to use

To use, simply install the package in your testing environment and laod the django-testing-psotgresql plugin when running pytest (pytest normally auto-discovers it).

The plugin re-uses the configuration used by pytest-django.

By default, only the default database is setup. You can modify this by setting PYTEST_SETUP_DATABASES to a list of database aliases in your settings module. The list can contain strings, or tuples if you want some aliases to share the same database backend.

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-testing-postgresql-0.2.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file pytest-django-testing-postgresql-0.2.tar.gz.

File metadata

  • Download URL: pytest-django-testing-postgresql-0.2.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.6.4 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.10

File hashes

Hashes for pytest-django-testing-postgresql-0.2.tar.gz
Algorithm Hash digest
SHA256 0c256e262f144fbb0c717d592a649dbfe2852f4648c53c1a011cf48ccd8e0762
MD5 c6cec684b89eebd7697d835e137314b4
BLAKE2b-256 81eabf20af6bd0a88846b7875b3e4feea8d446b1d6010615aa72f853aa425e15

See more details on using hashes here.

File details

Details for the file pytest_django_testing_postgresql-0.2-py3-none-any.whl.

File metadata

  • Download URL: pytest_django_testing_postgresql-0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.6.4 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.10

File hashes

Hashes for pytest_django_testing_postgresql-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cd5807ae4d121920f6f10c42ccea5dec9f4a204c0ae1ea82adad29f59ac8a7c4
MD5 29912271bc1fd65f91776cf2ff609851
BLAKE2b-256 11bd40afceaea1ad0b440bc9426b1dcaac891c0710ec496dca777a3c2498cf2c

See more details on using hashes here.

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