Take the 2-minute tour ×

I'm experiencing the same problem as with: django - "manage.py test" fails "table already exists"

The schemamigration / migration worked fine (although did have some problems that required me to --fake, but all subsequent migrations with south work). But when I run a unit test I get:

(1050, "Table '{tablename}' already exists")

I'm just curious how I can get round this, and why this happens. The only answer given in the question linked above was that south could be excluded from unit tests, if I do this does it mean I can't unit test with tables managed by south?

Explanations much appreciated :)


share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

No, it doesn't mean that. Don't forget that Django already knows what your tables should look like if you create them from scratch now - it just uses the model definitions. South is useful because it allows you to easily transform your table structure when you change your models, but when you're running tests you don't care about that: you just want the tests run on the current versions of the tables.

So yes, disable South when running tests, via SOUTH_TESTS_MIGRATE = False, and Django will automatically create the tables for you.

share|improve this answer
Cheers another django concept (i'm moving from php) you've cleared up in my fuddled brain –  null Feb 10 '11 at 14:29
add comment

Your Answer


