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
bbea35f1
Kaydet (Commit)
bbea35f1
authored
Kas 01, 2010
tarafından
Michael Foord
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix issue 9926. TestSuite subclasses that override __call__ are called correctly.
üst
e6fa3811
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
19 deletions
+32
-19
result.py
Lib/unittest/result.py
+1
-0
suite.py
Lib/unittest/suite.py
+17
-19
test_suite.py
Lib/unittest/test/test_suite.py
+14
-0
No files found.
Lib/unittest/result.py
Dosyayı görüntüle @
bbea35f1
...
...
@@ -34,6 +34,7 @@ class TestResult(object):
formatted traceback of the error that occurred.
"""
_previousTestClass
=
None
_testRunEntered
=
False
_moduleSetUpFailed
=
False
def
__init__
(
self
,
stream
=
None
,
descriptions
=
None
,
verbosity
=
None
):
self
.
failfast
=
False
...
...
Lib/unittest/suite.py
Dosyayı görüntüle @
bbea35f1
...
...
@@ -77,23 +77,11 @@ class TestSuite(BaseTestSuite):
subclassing, do not forget to call the base class constructor.
"""
def
run
(
self
,
result
,
debug
=
False
):
topLevel
=
False
if
getattr
(
result
,
'_testRunEntered'
,
False
)
is
False
:
result
.
_testRunEntered
=
topLevel
=
True
def
run
(
self
,
result
):
self
.
_wrapped_run
(
result
)
self
.
_tearDownPreviousClass
(
None
,
result
)
self
.
_handleModuleTearDown
(
result
)
return
result
def
debug
(
self
):
"""Run the tests without collecting errors in a TestResult"""
debug
=
_DebugResult
()
self
.
_wrapped_run
(
debug
,
True
)
self
.
_tearDownPreviousClass
(
None
,
debug
)
self
.
_handleModuleTearDown
(
debug
)
################################
# private methods
def
_wrapped_run
(
self
,
result
,
debug
=
False
):
for
test
in
self
:
if
result
.
shouldStop
:
break
...
...
@@ -108,13 +96,23 @@ class TestSuite(BaseTestSuite):
getattr
(
result
,
'_moduleSetUpFailed'
,
False
)):
continue
if
hasattr
(
test
,
'_wrapped_run'
):
test
.
_wrapped_run
(
result
,
debug
)
elif
not
debug
:
if
not
debug
:
test
(
result
)
else
:
test
.
debug
()
if
topLevel
:
self
.
_tearDownPreviousClass
(
None
,
result
)
self
.
_handleModuleTearDown
(
result
)
return
result
def
debug
(
self
):
"""Run the tests without collecting errors in a TestResult"""
debug
=
_DebugResult
()
self
.
run
(
debug
,
True
)
################################
def
_handleClassSetUp
(
self
,
test
,
result
):
previousClass
=
getattr
(
result
,
'_previousTestClass'
,
None
)
currentClass
=
test
.
__class__
...
...
Lib/unittest/test/test_suite.py
Dosyayı görüntüle @
bbea35f1
...
...
@@ -345,5 +345,19 @@ class Test_TestSuite(unittest.TestCase, TestEquality):
self
.
assertEqual
(
result
.
testsRun
,
2
)
def
test_overriding_call
(
self
):
class
MySuite
(
unittest
.
TestSuite
):
called
=
False
def
__call__
(
self
,
*
args
,
**
kw
):
self
.
called
=
True
unittest
.
TestSuite
.
__call__
(
self
,
*
args
,
**
kw
)
suite
=
MySuite
()
wrapper
=
unittest
.
TestSuite
()
wrapper
.
addTest
(
suite
)
wrapper
(
unittest
.
TestResult
())
self
.
assertTrue
(
suite
.
called
)
if
__name__
==
'__main__'
:
unittest
.
main
()
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