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
20054477
Kaydet (Commit)
20054477
authored
Şub 23, 2013
tarafından
Petri Lehtinen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #15132: Allow a list for the defaultTest argument of unittest.TestProgram
Patch by Jyrki Pulliainen
üst
d784e53d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
1 deletion
+42
-1
main.py
Lib/unittest/main.py
+4
-1
test_program.py
Lib/unittest/test/test_program.py
+35
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/unittest/main.py
Dosyayı görüntüle @
20054477
...
...
@@ -164,7 +164,10 @@ class TestProgram(object):
# to support python -m unittest ...
self
.
module
=
None
else
:
self
.
testNames
=
(
self
.
defaultTest
,)
if
isinstance
(
self
.
defaultTest
,
str
):
self
.
testNames
=
(
self
.
defaultTest
,)
else
:
self
.
testNames
=
list
(
self
.
defaultTest
)
self
.
createTests
()
def
createTests
(
self
):
...
...
Lib/unittest/test/test_program.py
Dosyayı görüntüle @
20054477
...
...
@@ -64,6 +64,41 @@ class Test_TestProgram(unittest.TestCase):
return
self
.
suiteClass
(
[
self
.
loadTestsFromTestCase
(
Test_TestProgram
.
FooBar
)])
def
loadTestsFromNames
(
self
,
names
,
module
):
return
self
.
suiteClass
(
[
self
.
loadTestsFromTestCase
(
Test_TestProgram
.
FooBar
)])
def
test_defaultTest_with_string
(
self
):
class
FakeRunner
(
object
):
def
run
(
self
,
test
):
self
.
test
=
test
return
True
old_argv
=
sys
.
argv
sys
.
argv
=
[
'faketest'
]
runner
=
FakeRunner
()
program
=
unittest
.
TestProgram
(
testRunner
=
runner
,
exit
=
False
,
defaultTest
=
'unittest.test'
,
testLoader
=
self
.
FooBarLoader
())
sys
.
argv
=
old_argv
self
.
assertEquals
((
'unittest.test'
,),
program
.
testNames
)
def
test_defaultTest_with_iterable
(
self
):
class
FakeRunner
(
object
):
def
run
(
self
,
test
):
self
.
test
=
test
return
True
old_argv
=
sys
.
argv
sys
.
argv
=
[
'faketest'
]
runner
=
FakeRunner
()
program
=
unittest
.
TestProgram
(
testRunner
=
runner
,
exit
=
False
,
defaultTest
=
[
'unittest.test'
,
'unittest.test2'
],
testLoader
=
self
.
FooBarLoader
())
sys
.
argv
=
old_argv
self
.
assertEquals
([
'unittest.test'
,
'unittest.test2'
],
program
.
testNames
)
def
test_NonExit
(
self
):
program
=
unittest
.
main
(
exit
=
False
,
...
...
Misc/NEWS
Dosyayı görüntüle @
20054477
...
...
@@ -260,6 +260,9 @@ Core and Builtins
Library
-------
-
Issue
#
15132
:
Allow
a
list
for
the
defaultTest
argument
of
unittest
.
TestProgram
.
Patch
by
Jyrki
Pulliainen
.
-
Issue
#
17225
:
JSON
decoder
now
counts
columns
in
the
first
line
starting
with
1
,
as
in
other
lines
.
...
...
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