diff --git a/tests/regressiontests/transactions_regress/models.py b/tests/regressiontests/transactions_regress/models.py index e8bca8ada2..a4b576c3ca 100644 --- a/tests/regressiontests/transactions_regress/models.py +++ b/tests/regressiontests/transactions_regress/models.py @@ -1,10 +1,13 @@ from django.db import models + class Mod(models.Model): fld = models.IntegerField() + class M2mA(models.Model): others = models.ManyToManyField('M2mB') + class M2mB(models.Model): fld = models.IntegerField() diff --git a/tests/regressiontests/transactions_regress/tests.py b/tests/regressiontests/transactions_regress/tests.py index 5d1ab2c6f6..e76208d72c 100644 --- a/tests/regressiontests/transactions_regress/tests.py +++ b/tests/regressiontests/transactions_regress/tests.py @@ -42,7 +42,7 @@ class TestTransactionClosing(TransactionTestCase): @commit_manually def non_comitter(): "Execute a managed transaction with read-only operations and fail to commit" - _ = Mod.objects.count() + Mod.objects.count() self.assertRaises(TransactionManagementError, non_comitter) @@ -56,7 +56,7 @@ class TestTransactionClosing(TransactionTestCase): """ Perform a database query, then commit the transaction """ - _ = Mod.objects.count() + Mod.objects.count() transaction.commit() try: @@ -74,7 +74,7 @@ class TestTransactionClosing(TransactionTestCase): """ Perform a database query, then rollback the transaction """ - _ = Mod.objects.count() + Mod.objects.count() transaction.rollback() try: @@ -90,9 +90,9 @@ class TestTransactionClosing(TransactionTestCase): @commit_manually def fake_committer(): "Query, commit, then query again, leaving with a pending transaction" - _ = Mod.objects.count() + Mod.objects.count() transaction.commit() - _ = Mod.objects.count() + Mod.objects.count() self.assertRaises(TransactionManagementError, fake_committer) @@ -239,7 +239,7 @@ class SavepointTest(TransactionTestCase): mod = Mod.objects.create(fld=1) pk = mod.pk sid = transaction.savepoint() - mod1 = Mod.objects.filter(pk=pk).update(fld=10) + Mod.objects.filter(pk=pk).update(fld=10) transaction.savepoint_commit(sid) mod2 = Mod.objects.get(pk=pk) transaction.commit() @@ -257,7 +257,7 @@ class SavepointTest(TransactionTestCase): mod = Mod.objects.create(fld=1) pk = mod.pk sid = transaction.savepoint() - mod1 = Mod.objects.filter(pk=pk).update(fld=20) + Mod.objects.filter(pk=pk).update(fld=20) transaction.savepoint_rollback(sid) mod2 = Mod.objects.get(pk=pk) transaction.commit()