'Running Django test gives "psycopg2.errors.DuplicateTable: relation already exists" error
I restored a database from a text (sql) file:
psql ideatree < ideatree.sql
which works with no errors.
After running migrations I bring up the Django development server and the site comes up fine.
But when I run tests:
python manage.py test
I get the error:
psycopg2.errors.DuplicateTable: relation "ideatree_colors" already exists
"ideatree_colors" is a table in the db, but test is creating its own separate test database, and indeed after this error the test database is left behind (I delete it before running tests again).
I completely dropped the cluster, re-installed Postgresql-13, restored the database, and ran migrations again. Same error.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
