From 6ede1db331d59e9a89eaa65101629d0ff642f8fc Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Tue, 24 Sep 2013 11:00:00 +0100 Subject: [PATCH] Fixed #21151 -- Bad cleanup in schema M2M repoint test --- tests/schema/tests.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/schema/tests.py b/tests/schema/tests.py index f6125ee9f3..9aac9fb5a7 100644 --- a/tests/schema/tests.py +++ b/tests/schema/tests.py @@ -307,6 +307,9 @@ class SchemaTests(TransactionTestCase): else: self.fail("No FK constraint for uniquetest_id found") finally: + # Cleanup through table separately + with connection.schema_editor() as editor: + editor.remove_field(BookWithM2M, BookWithM2M._meta.get_field_by_name("uniques")[0]) # Cleanup model states BookWithM2M._meta.local_many_to_many.remove(new_field) del BookWithM2M._meta._m2m_cache