diff --git a/pytest_django_testing_postgresql.py b/pytest_django_testing_postgresql.py index 38913362ea72ddafbce047bd934d4b27ccb81f3d..3321c6917ec765ebf234c12e9e4db22feed418d0 100644 --- a/pytest_django_testing_postgresql.py +++ b/pytest_django_testing_postgresql.py @@ -1,7 +1,10 @@ from dj_database_url import parse from django.conf import settings +import pytest from testing.postgresql import Postgresql -_postgresql = Postgresql() -django.settings.DATABASES['default'] = parse(_postgresql.url()) +@pytest.hookimpl(tryfirst=True) +def pytest_load_initial_conftests(early_config, parser, args): + _postgresql = Postgresql() + settings.configure(DATABASES={'default': parse(_postgresql.url())})