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
93f2cd2e
Kaydet (Commit)
93f2cd2e
authored
Tem 22, 2009
tarafından
Alexandre Vassalotti
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use unittest.SkipTest to skip tests in test_threading.
üst
a64ba363
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
21 deletions
+11
-21
test_threading.py
Lib/test/test_threading.py
+11
-21
No files found.
Lib/test/test_threading.py
Dosyayı görüntüle @
93f2cd2e
...
@@ -10,6 +10,7 @@ import _thread
...
@@ -10,6 +10,7 @@ import _thread
import
time
import
time
import
unittest
import
unittest
import
weakref
import
weakref
import
os
# A trivial mutable counter.
# A trivial mutable counter.
class
Counter
(
object
):
class
Counter
(
object
):
...
@@ -109,9 +110,8 @@ class ThreadTests(unittest.TestCase):
...
@@ -109,9 +110,8 @@ class ThreadTests(unittest.TestCase):
try
:
try
:
threading
.
stack_size
(
262144
)
threading
.
stack_size
(
262144
)
except
_thread
.
error
:
except
_thread
.
error
:
if
verbose
:
raise
unittest
.
SkipTest
(
print
(
'platform does not support changing thread stack size'
)
'platform does not support changing thread stack size'
)
return
self
.
test_various_ops
()
self
.
test_various_ops
()
threading
.
stack_size
(
0
)
threading
.
stack_size
(
0
)
...
@@ -122,9 +122,8 @@ class ThreadTests(unittest.TestCase):
...
@@ -122,9 +122,8 @@ class ThreadTests(unittest.TestCase):
try
:
try
:
threading
.
stack_size
(
0x100000
)
threading
.
stack_size
(
0x100000
)
except
_thread
.
error
:
except
_thread
.
error
:
if
verbose
:
raise
unittest
.
SkipTest
(
print
(
'platform does not support changing thread stack size'
)
'platform does not support changing thread stack size'
)
return
self
.
test_various_ops
()
self
.
test_various_ops
()
threading
.
stack_size
(
0
)
threading
.
stack_size
(
0
)
...
@@ -154,9 +153,7 @@ class ThreadTests(unittest.TestCase):
...
@@ -154,9 +153,7 @@ class ThreadTests(unittest.TestCase):
try
:
try
:
import
ctypes
import
ctypes
except
ImportError
:
except
ImportError
:
if
verbose
:
raise
unittest
.
SkipTest
(
"cannot import ctypes"
)
print
(
"test_PyThreadState_SetAsyncExc can't import ctypes"
)
return
# can't do anything
set_async_exc
=
ctypes
.
pythonapi
.
PyThreadState_SetAsyncExc
set_async_exc
=
ctypes
.
pythonapi
.
PyThreadState_SetAsyncExc
...
@@ -226,9 +223,7 @@ class ThreadTests(unittest.TestCase):
...
@@ -226,9 +223,7 @@ class ThreadTests(unittest.TestCase):
try
:
try
:
import
ctypes
import
ctypes
except
ImportError
:
except
ImportError
:
if
verbose
:
raise
unittest
.
SkipTest
(
"cannot import ctypes"
)
print
(
"test_finalize_with_runnning_thread can't import ctypes"
)
return
# can't do anything
import
subprocess
import
subprocess
rc
=
subprocess
.
call
([
sys
.
executable
,
"-c"
,
"""if 1:
rc
=
subprocess
.
call
([
sys
.
executable
,
"-c"
,
"""if 1:
...
@@ -387,11 +382,9 @@ class ThreadJoinOnShutdown(unittest.TestCase):
...
@@ -387,11 +382,9 @@ class ThreadJoinOnShutdown(unittest.TestCase):
self
.
_run_and_join
(
script
)
self
.
_run_and_join
(
script
)
@unittest.skipUnless
(
hasattr
(
os
,
'fork'
),
"needs os.fork()"
)
def
test_2_join_in_forked_process
(
self
):
def
test_2_join_in_forked_process
(
self
):
# Like the test above, but from a forked interpreter
# Like the test above, but from a forked interpreter
import
os
if
not
hasattr
(
os
,
'fork'
):
return
script
=
"""if 1:
script
=
"""if 1:
childpid = os.fork()
childpid = os.fork()
if childpid != 0:
if childpid != 0:
...
@@ -405,18 +398,15 @@ class ThreadJoinOnShutdown(unittest.TestCase):
...
@@ -405,18 +398,15 @@ class ThreadJoinOnShutdown(unittest.TestCase):
"""
"""
self
.
_run_and_join
(
script
)
self
.
_run_and_join
(
script
)
@unittest.skipUnless
(
hasattr
(
os
,
'fork'
),
"needs os.fork()"
)
def
test_3_join_in_forked_from_thread
(
self
):
def
test_3_join_in_forked_from_thread
(
self
):
# Like the test above, but fork() was called from a worker thread
# Like the test above, but fork() was called from a worker thread
# In the forked process, the main Thread object must be marked as stopped.
# In the forked process, the main Thread object must be marked as stopped.
import
os
if
not
hasattr
(
os
,
'fork'
):
return
# Skip platforms with known problems forking from a worker thread.
# Skip platforms with known problems forking from a worker thread.
# See http://bugs.python.org/issue3863.
# See http://bugs.python.org/issue3863.
if
sys
.
platform
in
(
'freebsd4'
,
'freebsd5'
,
'freebsd6'
,
'os2emx'
):
if
sys
.
platform
in
(
'freebsd4'
,
'freebsd5'
,
'freebsd6'
,
'os2emx'
):
raise
unittest
.
SkipTest
(
raise
unittest
.
SkipTest
(
'due to known OS bugs on '
+
sys
.
platform
)
'test_3_join_in_forked_from_thread due to known OS bugs on '
+
sys
.
platform
)
script
=
"""if 1:
script
=
"""if 1:
main_thread = threading.current_thread()
main_thread = threading.current_thread()
def worker():
def worker():
...
...
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