diff --git a/tests/transactions/tests.py b/tests/transactions/tests.py
index 5e947de..e8c2f9b 100644
a
|
b
|
|
1 | 1 | from __future__ import unicode_literals |
2 | 2 | |
| 3 | import os |
3 | 4 | import sys |
4 | 5 | import threading |
5 | 6 | import time |
… |
… |
class AtomicTests(TransactionTestCase):
|
218 | 219 | transaction.savepoint_rollback(sid) |
219 | 220 | self.assertQuerysetEqual(Reporter.objects.all(), ['<Reporter: Tintin>']) |
220 | 221 | |
| 222 | def test_rollback_on_keyboardinterrupt(self): |
| 223 | try: |
| 224 | with transaction.atomic(): |
| 225 | Reporter.objects.create(first_name='Haddock') |
| 226 | # Send SIGINT (simulate Ctrl-C). One call isn't enough. |
| 227 | os.kill(os.getpid(), 2) |
| 228 | os.kill(os.getpid(), 2) |
| 229 | except KeyboardInterrupt: |
| 230 | pass |
| 231 | self.assertEqual(Reporter.objects.all().count(), 0) |
| 232 | |
221 | 233 | |
222 | 234 | class AtomicInsideTransactionTests(AtomicTests): |
223 | 235 | """All basic tests for atomic should also pass within an existing transaction.""" |