Permalink
Browse files

Remove most errors when running migration tests twice

  • Loading branch information...
1 parent fe9f342 commit f671fb9d1182afd15d471bf05639052cc8a7cde7 @andrewgodwin andrewgodwin committed Sep 25, 2013
Showing with 10 additions and 0 deletions.
  1. +10 −0 tests/migrations/test_operations.py
@@ -16,6 +16,16 @@ def set_up_test_model(self, app_label, second_model=False):
"""
Creates a test model state and database table.
"""
+ # Delete the tables if they already exist
+ cursor = connection.cursor()
+ try:
+ cursor.execute("DROP TABLE %s_pony" % app_label)
+ except:
+ pass
+ try:
+ cursor.execute("DROP TABLE %s_stable" % app_label)
+ except:
+ pass
# Make the "current" state
operations = [migrations.CreateModel(
"Pony",

0 comments on commit f671fb9

Please sign in to comment.