2
pytest-djangoがテストデータベースを作成するときにPostgres拡張機能をインストールしたいと思います。私はこれをうまく動作させるためにconftest.pyを手に入れましたが、私は立ち往生しています。pytest-djangoでpostgresデータベースを設定するには?
マイconftest.pyは私のプロジェクト(manage.pyと同じディレクトリ)のトップレベルであり、含まれています
from django.db import connection
import pytest_django
@pytest.fixture(scope='session')
def django_db_setup(*args, **kwargs):
pytest_django.fixtures.django_db_setup(*args, **kwargs)
cursor = connection.cursor()
cursor.execute("create extension pg_trgm")
しかし、私はそれを実行したときに、私が取得:
_pytest.vendored_packages.pluggy.PluginValidationError: unknown hook 'pytest_django' in plugin <module 'conftest' from '/path/to/my/conftest.py'>
ありがとうございます@lefterisnik、これはうまく動作しています:-) – rmoorman