Skip to content

Commit

Permalink
Fix M2M interaction with transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgodwin committed Jul 2, 2013
1 parent b1e0ec0 commit 310cdf4
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions tests/schema/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ def test_m2m(self):
try:
# Ensure there's no m2m table there
self.assertRaises(DatabaseError, self.column_classes, new_field.rel.through)
connection.rollback()
# Add the field
with connection.schema_editor() as editor:
editor.add_field(
Expand All @@ -268,11 +267,9 @@ def test_m2m(self):
)
# Ensure there's no m2m table there
self.assertRaises(DatabaseError, self.column_classes, new_field.rel.through)
connection.rollback()
finally:
# Cleanup model states
AuthorWithM2M._meta.local_many_to_many.remove(new_field)
del AuthorWithM2M._meta._m2m_cache

def test_m2m_repoint(self):
"""
Expand Down Expand Up @@ -305,7 +302,6 @@ def test_m2m_repoint(self):
)
# Ensure old M2M is gone
self.assertRaises(DatabaseError, self.column_classes, BookWithM2M._meta.get_field_by_name("tags")[0].rel.through)
connection.rollback()
# Ensure the new M2M exists and points to UniqueTest
constraints = connection.introspection.get_constraints(connection.cursor(), new_field.rel.through._meta.db_table)
if connection.features.supports_foreign_keys:
Expand Down

0 comments on commit 310cdf4

Please sign in to comment.