Updated a test that doesn't make sense with autocommit.

This commit is contained in:
Aymeric Augustin 2013-03-07 17:20:15 +01:00
parent 423c0d5e29
commit 0cee3c0e43
1 changed files with 15 additions and 13 deletions

View File

@ -4,7 +4,7 @@ from django.db import connection, connections, transaction, DEFAULT_DB_ALIAS, Da
from django.db.transaction import commit_on_success, commit_manually, TransactionManagementError
from django.test import TransactionTestCase, skipUnlessDBFeature
from django.test.utils import override_settings
from django.utils.unittest import skipIf, skipUnless, expectedFailure
from django.utils.unittest import skipIf, skipUnless
from transactions.tests import IgnorePendingDeprecationWarningsMixin
@ -187,12 +187,12 @@ class TestNewConnection(IgnorePendingDeprecationWarningsMixin, TransactionTestCa
connections[DEFAULT_DB_ALIAS].close()
connections[DEFAULT_DB_ALIAS] = self._old_backend
# TODO: update this test to account for database-level autocommit.
@expectedFailure
def test_commit(self):
"""
Users are allowed to commit and rollback connections.
"""
connection.set_autocommit(False)
try:
# The starting value is False, not None.
self.assertIs(connection._dirty, False)
list(Mod.objects.all())
@ -203,6 +203,8 @@ class TestNewConnection(IgnorePendingDeprecationWarningsMixin, TransactionTestCa
self.assertTrue(connection.is_dirty())
connection.rollback()
self.assertFalse(connection.is_dirty())
finally:
connection.set_autocommit(True)
def test_enter_exit_management(self):
orig_dirty = connection._dirty