Reputation: 4929
The title isn't clear, I know that.
I want to unit test my application so I wrote a little test that I wanted to execute. I launched python manage.py test
but there was an error in the DB :
The error was: ERREUR: the relation « me_auth_emailuser » doesn't exists
Error in migration: authtoken:0001_initial
DatabaseError: ERREUR: the relation « me_auth_emailuser » doesn't exists
(Translated from french)
This table has been migrated using south. For my application, I just use :
python manage.py syncdb
python manage.py migrate me_auth
python manage.py migrate
I don't understand what is going on, because with these commands I don't get any error... Can someone help me with that ? :)
Upvotes: 2
Views: 350
Reputation: 99761
Presumably at some point you had a relation me_auth_email_user
, that you no longer have. I imagine you'd get the same error if you were to create a fresh database, and run:
python manage.py syncdb
python manage.py migrate
There are two solutions to this:
INSTALLED_APPS
if you're testing, as below, or by setting SOUTH_TESTS_MIGRATE = False
in your settings.py
).A quick and hacky way to remove South during tests is to have something like this in your settings.py
, below where your normal INSTALLED_APPS
setting is:
import sys
if 'test' in sys.argv:
INSTALLED_APPS = [app for app in INSTALLED_APPS if app != 'south']
In general, testing migrations is a good thing - you should always be able to create a new database and run migrate
- so I'd strongly recommend considering option (2).
Upvotes: 2