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
5a6d4bf6
Kaydet (Commit)
5a6d4bf6
authored
Ock 20, 2014
tarafından
Gregory P. Smith
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixes Issue #20165: The unittest module no longer considers tests marked with
@expectedFailure successful if they pass.
üst
b599c611
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
5 deletions
+17
-5
unittest.rst
Doc/library/unittest.rst
+4
-0
result.py
Lib/unittest/result.py
+8
-3
test_skipping.py
Lib/unittest/test/test_skipping.py
+2
-2
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/unittest.rst
Dosyayı görüntüle @
5a6d4bf6
...
...
@@ -1772,6 +1772,10 @@ Loading and running tests
Return ``True`` if all tests run so far have passed, otherwise returns
``False``.
.. versionchanged:: 3.4
Returns ``False`` if there were any :attr:`unexpectedSuccesses`
from tests marked with the :func:`expectedFailure` decorator.
.. method:: stop()
...
...
Lib/unittest/result.py
Dosyayı görüntüle @
5a6d4bf6
...
...
@@ -156,11 +156,16 @@ class TestResult(object):
self
.
unexpectedSuccesses
.
append
(
test
)
def
wasSuccessful
(
self
):
"Tells whether or not this result was a success"
return
len
(
self
.
failures
)
==
len
(
self
.
errors
)
==
0
"""Tells whether or not this result was a success."""
# The hasattr check is for test_result's OldResult test. That
# way this method works on objects that lack the attribute.
# (where would such result intances come from? old stored pickles?)
return
((
len
(
self
.
failures
)
==
len
(
self
.
errors
)
==
0
)
and
(
not
hasattr
(
self
,
'unexpectedSuccesses'
)
or
len
(
self
.
unexpectedSuccesses
)
==
0
))
def
stop
(
self
):
"
Indicates that the tests should be aborted
"
"
""Indicates that the tests should be aborted.""
"
self
.
shouldStop
=
True
def
_exc_info_to_string
(
self
,
err
,
test
):
...
...
Lib/unittest/test/test_skipping.py
Dosyayı görüntüle @
5a6d4bf6
...
...
@@ -158,7 +158,7 @@ class Test_TestSkipping(unittest.TestCase):
[
'startTest'
,
'addUnexpectedSuccess'
,
'stopTest'
])
self
.
assertFalse
(
result
.
failures
)
self
.
assertEqual
(
result
.
unexpectedSuccesses
,
[
test
])
self
.
assert
Tru
e
(
result
.
wasSuccessful
())
self
.
assert
Fals
e
(
result
.
wasSuccessful
())
def
test_unexpected_success_subtests
(
self
):
# Success in all subtests counts as the unexpected success of
...
...
@@ -182,7 +182,7 @@ class Test_TestSkipping(unittest.TestCase):
'addUnexpectedSuccess'
,
'stopTest'
])
self
.
assertFalse
(
result
.
failures
)
self
.
assertEqual
(
result
.
unexpectedSuccesses
,
[
test
])
self
.
assert
Tru
e
(
result
.
wasSuccessful
())
self
.
assert
Fals
e
(
result
.
wasSuccessful
())
def
test_skip_doesnt_run_setup
(
self
):
class
Foo
(
unittest
.
TestCase
):
...
...
Misc/NEWS
Dosyayı görüntüle @
5a6d4bf6
...
...
@@ -25,6 +25,9 @@ Core and Builtins
Library
-------
- Issue #20165: The unittest module no longer considers tests marked with
@expectedFailure successful if they pass.
- Issue #18574: Added missing newline in 100-Continue reply from
http.server.BaseHTTPRequestHandler. Patch by Nikolaus Rath.
...
...
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