[1.11.x] Reverted "Refs #16682 -- Tested transaction.atomic() with KeyboardInterrupt."
This reverts commitd895fc9ac0
since the test is problematic as described in the ticket. Backport ofdfbdba924f
from master
This commit is contained in:
parent
993406770a
commit
e9ba8563c1
|
@ -1,7 +1,5 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import os
|
|
||||||
import signal
|
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
|
@ -220,18 +218,6 @@ class AtomicTests(TransactionTestCase):
|
||||||
transaction.savepoint_rollback(sid)
|
transaction.savepoint_rollback(sid)
|
||||||
self.assertQuerysetEqual(Reporter.objects.all(), ['<Reporter: Tintin>'])
|
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):
|
class AtomicInsideTransactionTests(AtomicTests):
|
||||||
"""All basic tests for atomic should also pass within an existing transaction."""
|
"""All basic tests for atomic should also pass within an existing transaction."""
|
||||||
|
|
Loading…
Reference in New Issue