Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove most errors when running migration tests twice

  • Loading branch information...
commit f671fb9d1182afd15d471bf05639052cc8a7cde7 1 parent fe9f342
@andrewgodwin andrewgodwin authored
Showing with 10 additions and 0 deletions.
  1. +10 −0 tests/migrations/test_operations.py
View
10 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",
Please sign in to comment.
Something went wrong with that request. Please try again.