Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
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
cpython
Commits
5b9eccb3
Kaydet (Commit)
5b9eccb3
authored
Agu 28, 2012
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #15794: Relax a test case due to the deadlock detection's conservativeness.
üst
fc35ecec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
test_locks.py
Lib/test/test_importlib/test_locks.py
+18
-4
No files found.
Lib/test/test_importlib/test_locks.py
Dosyayı görüntüle @
5b9eccb3
from
importlib
import
_bootstrap
from
importlib
import
_bootstrap
import
sys
import
time
import
time
import
unittest
import
unittest
import
weakref
import
weakref
...
@@ -41,6 +42,17 @@ else:
...
@@ -41,6 +42,17 @@ else:
@unittest.skipUnless
(
threading
,
"threads needed for this test"
)
@unittest.skipUnless
(
threading
,
"threads needed for this test"
)
class
DeadlockAvoidanceTests
(
unittest
.
TestCase
):
class
DeadlockAvoidanceTests
(
unittest
.
TestCase
):
def
setUp
(
self
):
try
:
self
.
old_switchinterval
=
sys
.
getswitchinterval
()
sys
.
setswitchinterval
(
0.000001
)
except
AttributeError
:
self
.
old_switchinterval
=
None
def
tearDown
(
self
):
if
self
.
old_switchinterval
is
not
None
:
sys
.
setswitchinterval
(
self
.
old_switchinterval
)
def
run_deadlock_avoidance_test
(
self
,
create_deadlock
):
def
run_deadlock_avoidance_test
(
self
,
create_deadlock
):
NLOCKS
=
10
NLOCKS
=
10
locks
=
[
LockType
(
str
(
i
))
for
i
in
range
(
NLOCKS
)]
locks
=
[
LockType
(
str
(
i
))
for
i
in
range
(
NLOCKS
)]
...
@@ -75,10 +87,12 @@ class DeadlockAvoidanceTests(unittest.TestCase):
...
@@ -75,10 +87,12 @@ class DeadlockAvoidanceTests(unittest.TestCase):
def
test_deadlock
(
self
):
def
test_deadlock
(
self
):
results
=
self
.
run_deadlock_avoidance_test
(
True
)
results
=
self
.
run_deadlock_avoidance_test
(
True
)
# One of the threads detected a potential deadlock on its second
# At least one of the threads detected a potential deadlock on its
# acquire() call.
# second acquire() call. It may be several of them, because the
self
.
assertEqual
(
results
.
count
((
True
,
False
)),
1
)
# deadlock avoidance mechanism is conservative.
self
.
assertEqual
(
results
.
count
((
True
,
True
)),
len
(
results
)
-
1
)
nb_deadlocks
=
results
.
count
((
True
,
False
))
self
.
assertGreaterEqual
(
nb_deadlocks
,
1
)
self
.
assertEqual
(
results
.
count
((
True
,
True
)),
len
(
results
)
-
nb_deadlocks
)
def
test_no_deadlock
(
self
):
def
test_no_deadlock
(
self
):
results
=
self
.
run_deadlock_avoidance_test
(
False
)
results
=
self
.
run_deadlock_avoidance_test
(
False
)
...
...
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