can't debug pytests with access to postgresql

I want to debug pytests, and they run okey if I run them outside debugger. In debugger there is something like this

Synchronize unmigrated apps: accounts, messages, rest_framework, staticfiles
Apply all migrations: admin, auth, contenttypes, sessions
Synchronizing apps without migrations:
Creating tables...
Creating table accounts_user
Running deferred SQL...
web_app | Creating test database for alias 'default' ('test_postgres')...
Got an error creating the test database: database "test_postgres" already exists

Destroying old test database for alias 'default' ('test_postgres')...
web_app |
test setup failed
self = <django.db.backends.utils.CursorWrapper object at 0x7f55bdfa7a60>
sql = 'ALTER TABLE "accounts_user_groups" ADD CONSTRAINT "accounts_user_groups_group_id_bd11a704_fk_auth_group_id" FOREIGN KEY ("group_id") REFERENCES "auth_group" ("id") DEFERRABLE INITIALLY DEFERRED'
params = ()
ignored_wrapper_args = (False, {'connection': <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f55be6c5dc0>, 'cursor': <django.db.backends.utils.CursorWrapper object at 0x7f55bdfa7a60>})

def _execute(self, sql, params, *ignored_wrapper_args):
with self.db.wrap_database_errors:
if params is None:
# params default might be backend specific.
return self.cursor.execute(sql)
> return self.cursor.execute(sql, params)
E psycopg2.errors.UndefinedTable: relation "auth_group" does not exist


it seems like problem with access to postgresql

1 comment
Comment actions Permalink

Hi, it is very strange if you get different results by running the same configuration in normal and debug mode. Would it be possible to record a screencast demonstrating the issue?


Please sign in to leave a comment.