pytest-django icon indicating copy to clipboard operation
pytest-django copied to clipboard

pytest cannot find database and tables

Open yeseen opened this issue 4 years ago • 1 comments
trafficstars

Moved from https://github.com/pytest-dev/pytest-xdist/issues/690

OP post:

I am trying to speed up the test runtime by using pytest-xdist, previously I was using pytest, pytest-django to run the tests,

After installing pytest-xdist, One is an issue which I am facing is most of the tests are failing with messages that relation does not exist

pytest -n auto accounts/tests

for example psycopg2.errors.UndefinedTable: relation "auth_user" does not exist

I guess there is error which says database does not exist: django.db.utils.OperationalError: FATAL: database "test_dev" does not exist

But the interesting thing is some of tests are passing :(

I am having the same issue even with requesting the fixture django_db_modify_db_settings_parallel_suffix.

pytest -n auto runs 11 cores in my server, and I noticed that this problem happens less with -n 6 cores. And almost never happens with -n 2 . The issue started when we moved to a different server. The original one runs on only 2 cores with pytest -n auto.

E django.db.utils.OperationalError: FATAL: database "test_dev_gw1" does not exist

yeseen avatar Aug 21 '21 11:08 yeseen

Any news here?

bakwc avatar Aug 15 '22 19:08 bakwc