1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Reverted "Refs #16682 -- Tested transaction.atomic() with KeyboardInterrupt."

This reverts commit d895fc9ac0 since the
test is problematic as described in the ticket.
This commit is contained in:
Tim Graham 2017-03-09 09:55:55 -05:00
parent 9269dec05e
commit dfbdba924f

View File

@ -1,5 +1,3 @@
import os
import signal
import sys
import threading
import time
@ -218,18 +216,6 @@ class AtomicTests(TransactionTestCase):
transaction.savepoint_rollback(sid)
self.assertQuerysetEqual(Reporter.objects.all(), ['<Reporter: Tintin>'])
@skipIf(sys.platform.startswith('win'), "Windows doesn't have signals.")
def test_rollback_on_keyboardinterrupt(self):
try:
with transaction.atomic():
Reporter.objects.create(first_name='Tintin')
# Send SIGINT (simulate Ctrl-C). One call isn't enough.
os.kill(os.getpid(), signal.SIGINT)
os.kill(os.getpid(), signal.SIGINT)
except KeyboardInterrupt:
pass
self.assertEqual(Reporter.objects.all().count(), 0)
class AtomicInsideTransactionTests(AtomicTests):
"""All basic tests for atomic should also pass within an existing transaction."""