Ticket #16682: 16682-test.diff

File 16682-test.diff, 1.1 KB (added by Claude Paroz, 13 years ago)

Failing test

  • tests/regressiontests/transactions_regress/tests.py

    diff --git a/tests/regressiontests/transactions_regress/tests.py b/tests/regressiontests/transactions_regress/tests.py
    index 5972263..615446f 100644
    a b  
    11from __future__ import absolute_import
     2import os
    23
    34from django.core.exceptions import ImproperlyConfigured
    45from django.db import connection, transaction
    class TestTransactionClosing(TransactionTestCase):  
    174175        """
    175176        self.test_failing_query_transaction_closed()
    176177
     178    def test_rollback_on_keyboardinterrupt(self):
     179        try:
     180            with transaction.commit_on_success():
     181                Mod.objects.create(fld=17624)
     182                # Send SIGINT (simulate Ctrl-C) to self, one call seems not enough??
     183                os.kill(os.getpid(), 2)
     184                os.kill(os.getpid(), 2)
     185        except KeyboardInterrupt:
     186            pass
     187        self.assertEqual(Mod.objects.all().count(), 0)
     188
    177189
    178190class TestManyToManyAddTransaction(TransactionTestCase):
    179191    def test_manyrelated_add_commit(self):
Back to Top