diff options
author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-03-04 23:26:31 +0100 |
---|---|---|
committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-03-11 14:48:55 +0100 |
commit | 7c46c8d5f27fe305507359588ca0635b6d87c59a (patch) | |
tree | ca99a91cedfd6d8d03a3fbe334ee9589a51ef002 /tests/fixtures_model_package | |
parent | d7bc4fbc94df6c231d71dffa45cf337ff13512ee (diff) | |
download | django-7c46c8d5f27fe305507359588ca0635b6d87c59a.tar.gz |
Added some assertions to enforce the atomicity of atomic.
Diffstat (limited to 'tests/fixtures_model_package')
-rw-r--r-- | tests/fixtures_model_package/tests.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/fixtures_model_package/tests.py b/tests/fixtures_model_package/tests.py index d147fe68a7..894a6c7fde 100644 --- a/tests/fixtures_model_package/tests.py +++ b/tests/fixtures_model_package/tests.py @@ -25,7 +25,8 @@ class SampleTestCase(TestCase): class TestNoInitialDataLoading(TransactionTestCase): def test_syncdb(self): - with transaction.commit_manually(): + transaction.set_autocommit(autocommit=False) + try: Book.objects.all().delete() management.call_command( @@ -35,6 +36,9 @@ class TestNoInitialDataLoading(TransactionTestCase): ) self.assertQuerysetEqual(Book.objects.all(), []) transaction.rollback() + finally: + transaction.set_autocommit(autocommit=True) + def test_flush(self): # Test presence of fixture (flush called by TransactionTestCase) @@ -45,7 +49,8 @@ class TestNoInitialDataLoading(TransactionTestCase): lambda a: a.name ) - with transaction.commit_manually(): + transaction.set_autocommit(autocommit=False) + try: management.call_command( 'flush', verbosity=0, @@ -55,6 +60,8 @@ class TestNoInitialDataLoading(TransactionTestCase): ) self.assertQuerysetEqual(Book.objects.all(), []) transaction.rollback() + finally: + transaction.set_autocommit(autocommit=True) class FixtureTestCase(TestCase): |