Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
d895fc9a
Kaydet (Commit)
d895fc9a
authored
Eyl 21, 2016
tarafından
Claude Paroz
Kaydeden (comit)
Tim Graham
Eyl 21, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #16682 -- Tested transaction.atomic() with KeyboardInterrupt.
üst
ddef397b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
tests.py
tests/transactions/tests.py
+13
-0
No files found.
tests/transactions/tests.py
Dosyayı görüntüle @
d895fc9a
from
__future__
import
unicode_literals
import
os
import
sys
import
threading
import
time
...
...
@@ -218,6 +219,18 @@ 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
(),
2
)
os
.
kill
(
os
.
getpid
(),
2
)
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."""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment