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
25a40452
Kaydet (Commit)
25a40452
authored
Mar 05, 2013
tarafından
Ezio Melotti
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#11732: add a new suppress_crash_popup() context manager to test.support.
üst
884f0585
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
4 deletions
+40
-4
test.rst
Doc/library/test.rst
+7
-0
support.py
Lib/test/support.py
+23
-1
test_capi.py
Lib/test/test_capi.py
+2
-1
test_faulthandler.py
Lib/test/test_faulthandler.py
+4
-2
NEWS
Misc/NEWS
+4
-0
No files found.
Doc/library/test.rst
Dosyayı görüntüle @
25a40452
...
@@ -405,6 +405,13 @@ The :mod:`test.support` module defines the following functions:
...
@@ -405,6 +405,13 @@ The :mod:`test.support` module defines the following functions:
A decorator for running tests that require support for symbolic links.
A decorator for running tests that require support for symbolic links.
.. function:: suppress_crash_popup()
A context manager that disables Windows Error Reporting dialogs using
`SetErrorMode <http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621%28v=vs.85%29.aspx>`_.
On other platforms it's a no-op.
.. decorator:: anticipate_failure(condition)
.. decorator:: anticipate_failure(condition)
A decorator to conditionally mark tests with
A decorator to conditionally mark tests with
...
...
Lib/test/support.py
Dosyayı görüntüle @
25a40452
...
@@ -71,7 +71,7 @@ __all__ = [
...
@@ -71,7 +71,7 @@ __all__ = [
"TestHandler"
,
"Matcher"
,
"can_symlink"
,
"skip_unless_symlink"
,
"TestHandler"
,
"Matcher"
,
"can_symlink"
,
"skip_unless_symlink"
,
"skip_unless_xattr"
,
"import_fresh_module"
,
"requires_zlib"
,
"skip_unless_xattr"
,
"import_fresh_module"
,
"requires_zlib"
,
"PIPE_MAX_SIZE"
,
"failfast"
,
"anticipate_failure"
,
"run_with_tz"
,
"PIPE_MAX_SIZE"
,
"failfast"
,
"anticipate_failure"
,
"run_with_tz"
,
"requires_bz2"
,
"requires_lzma"
"requires_bz2"
,
"requires_lzma"
,
"suppress_crash_popup"
,
]
]
class
Error
(
Exception
):
class
Error
(
Exception
):
...
@@ -1905,6 +1905,28 @@ def skip_unless_xattr(test):
...
@@ -1905,6 +1905,28 @@ def skip_unless_xattr(test):
msg
=
"no non-broken extended attribute support"
msg
=
"no non-broken extended attribute support"
return
test
if
ok
else
unittest
.
skip
(
msg
)(
test
)
return
test
if
ok
else
unittest
.
skip
(
msg
)(
test
)
if
sys
.
platform
.
startswith
(
'win'
):
@contextlib.contextmanager
def
suppress_crash_popup
():
"""Disable Windows Error Reporting dialogs using SetErrorMode."""
# see http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621%28v=vs.85%29.aspx
import
ctypes
k32
=
ctypes
.
windll
.
kernel32
old_error_mode
=
k32
.
GetErrorMode
()
SEM_NOGPFAULTERRORBOX
=
0x02
k32
.
SetErrorMode
(
old_error_mode
|
SEM_NOGPFAULTERRORBOX
)
try
:
yield
finally
:
k32
.
SetErrorMode
(
old_error_mode
)
else
:
# this is a no-op for other platforms
@contextlib.contextmanager
def
suppress_crash_popup
():
yield
def
patch
(
test_instance
,
object_to_patch
,
attr_name
,
new_value
):
def
patch
(
test_instance
,
object_to_patch
,
attr_name
,
new_value
):
"""Override 'object_to_patch'.'attr_name' with 'new_value'.
"""Override 'object_to_patch'.'attr_name' with 'new_value'.
...
...
Lib/test/test_capi.py
Dosyayı görüntüle @
25a40452
...
@@ -44,7 +44,8 @@ class CAPITest(unittest.TestCase):
...
@@ -44,7 +44,8 @@ class CAPITest(unittest.TestCase):
@unittest.skipUnless
(
threading
,
'Threading required for this test.'
)
@unittest.skipUnless
(
threading
,
'Threading required for this test.'
)
def
test_no_FatalError_infinite_loop
(
self
):
def
test_no_FatalError_infinite_loop
(
self
):
p
=
subprocess
.
Popen
([
sys
.
executable
,
"-c"
,
with
support
.
suppress_crash_popup
():
p
=
subprocess
.
Popen
([
sys
.
executable
,
"-c"
,
'import _testcapi;'
'import _testcapi;'
'_testcapi.crash_no_current_thread()'
],
'_testcapi.crash_no_current_thread()'
],
stdout
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
...
...
Lib/test/test_faulthandler.py
Dosyayı görüntüle @
25a40452
...
@@ -101,7 +101,8 @@ class FaultHandlerTests(unittest.TestCase):
...
@@ -101,7 +101,8 @@ class FaultHandlerTests(unittest.TestCase):
header
=
re
.
escape
(
header
))
header
=
re
.
escape
(
header
))
if
other_regex
:
if
other_regex
:
regex
+=
'|'
+
other_regex
regex
+=
'|'
+
other_regex
output
,
exitcode
=
self
.
get_output
(
code
,
filename
)
with
support
.
suppress_crash_popup
():
output
,
exitcode
=
self
.
get_output
(
code
,
filename
)
output
=
'
\n
'
.
join
(
output
)
output
=
'
\n
'
.
join
(
output
)
self
.
assertRegex
(
output
,
regex
)
self
.
assertRegex
(
output
,
regex
)
self
.
assertNotEqual
(
exitcode
,
0
)
self
.
assertNotEqual
(
exitcode
,
0
)
...
@@ -229,7 +230,8 @@ faulthandler.disable()
...
@@ -229,7 +230,8 @@ faulthandler.disable()
faulthandler._read_null()
faulthandler._read_null()
"""
.
strip
()
"""
.
strip
()
not_expected
=
'Fatal Python error'
not_expected
=
'Fatal Python error'
stderr
,
exitcode
=
self
.
get_output
(
code
)
with
support
.
suppress_crash_popup
():
stderr
,
exitcode
=
self
.
get_output
(
code
)
stder
=
'
\n
'
.
join
(
stderr
)
stder
=
'
\n
'
.
join
(
stderr
)
self
.
assertTrue
(
not_expected
not
in
stderr
,
self
.
assertTrue
(
not_expected
not
in
stderr
,
"
%
r is present in
%
r"
%
(
not_expected
,
stderr
))
"
%
r is present in
%
r"
%
(
not_expected
,
stderr
))
...
...
Misc/NEWS
Dosyayı görüntüle @
25a40452
...
@@ -640,6 +640,10 @@ Library
...
@@ -640,6 +640,10 @@ Library
Tests
Tests
-----
-----
- Issue #11732: add a new suppress_crash_popup() context manager to test.support
that disables crash popups on Windows and use it in test_faulthandler and
test_ctypes.
- Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu.
- Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu.
- Issue #17249: convert a test in test_capi to use unittest and reap threads.
- Issue #17249: convert a test in test_capi to use unittest and reap threads.
...
...
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