Ticket #6669: 6669-test-only.diff

File 6669-test-only.diff, 1.4 KB (added by claudep, 3 years ago)

Test showing failure

  • tests/regressiontests/transactions_regress/tests.py

    diff --git a/tests/regressiontests/transactions_regress/tests.py b/tests/regressiontests/transactions_regress/tests.py
    index 22f1b0f..90aa123 100644
    a b from __future__ import absolute_import 
    33from django.core.exceptions import ImproperlyConfigured
    44from django.db import connection, transaction
    55from django.db.transaction import commit_on_success, commit_manually, TransactionManagementError
     6from django.db.utils import DatabaseError
    67from django.test import TransactionTestCase, skipUnlessDBFeature
     8from django.test.utils import override_settings
    79from django.utils.unittest import skipIf
    810
    911from .models import Mod, M2mA, M2mB
    class TestTransactionClosing(TransactionTestCase): 
    166168        except:
    167169            self.fail("A transaction consisting of a failed operation was not closed.")
    168170
     171        # Same test with DebugCursor
     172        with override_settings(DEBUG=True):
     173            self.assertRaises(Exception, create_system_user)
     174            try:
     175                self.assertEqual(User.objects.count(), 1)
     176            except DatabaseError:
     177                self.fail("A transaction consisting of a failed operation was not closed.")
     178
    169179
    170180class TestManyToManyAddTransaction(TransactionTestCase):
    171181    def test_manyrelated_add_commit(self):
Back to Top