jeudi 28 février 2019

Pytest-django migration error with --nomigrations option

I am trying to get pytest-django (3.4.8) working with my Django (2.1.1) project. I have --nomigrations set as per docs, because I don't want migrations for tests. However, when I run the test I see a migration error:

django.db.utils.ProgrammingError: relation "contact_contact" does not exist

This error does not occur when I run the app, so I assume it is something to do with my test setup. My pytest.ini:

[pytest]
DJANGO_SETTINGS_MODULE=my_app.settings.test
addopts = --capture=no --cov=. --cov-report=html --nomigrations
testpaths = tests

I'm using postgres, django-tenants, and the app and tests run inside of Docker. I'm not sure what actual code besides pytest.ini would be relevant to this issue, but I can provide more configs/code.

Aucun commentaire:

Enregistrer un commentaire