From f671fb9d1182afd15d471bf05639052cc8a7cde7 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Wed, 25 Sep 2013 16:11:05 +0100 Subject: [PATCH] Remove most errors when running migration tests twice --- tests/migrations/test_operations.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py index db79e730e22..723f1ce7411 100644 --- a/tests/migrations/test_operations.py +++ b/tests/migrations/test_operations.py @@ -16,6 +16,16 @@ class OperationTests(MigrationTestBase): """ 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",