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
f100dbd6
Kaydet (Commit)
f100dbd6
authored
Ara 19, 2010
tarafından
Michael Foord
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix minor issue in implementation of issue 10470.
üst
b3468f79
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
30 deletions
+54
-30
main.py
Lib/unittest/main.py
+40
-30
test_discovery.py
Lib/unittest/test/test_discovery.py
+13
-0
test_program.py
Lib/unittest/test/test_program.py
+1
-0
No files found.
Lib/unittest/main.py
Dosyayı görüntüle @
f100dbd6
...
...
@@ -147,38 +147,48 @@ class TestProgram(object):
long_opts
=
[
'help'
,
'verbose'
,
'quiet'
,
'failfast'
,
'catch'
,
'buffer'
]
try
:
options
,
args
=
getopt
.
getopt
(
argv
[
1
:],
'hHvqfcb'
,
long_opts
)
for
opt
,
value
in
options
:
if
opt
in
(
'-h'
,
'-H'
,
'--help'
):
self
.
usageExit
()
if
opt
in
(
'-q'
,
'--quiet'
):
self
.
verbosity
=
0
if
opt
in
(
'-v'
,
'--verbose'
):
self
.
verbosity
=
2
if
opt
in
(
'-f'
,
'--failfast'
):
if
self
.
failfast
is
None
:
self
.
failfast
=
True
# Should this raise an exception if -f is not valid?
if
opt
in
(
'-c'
,
'--catch'
):
if
self
.
catchbreak
is
None
:
self
.
catchbreak
=
True
# Should this raise an exception if -c is not valid?
if
opt
in
(
'-b'
,
'--buffer'
):
if
self
.
buffer
is
None
:
self
.
buffer
=
True
# Should this raise an exception if -b is not valid?
if
len
(
args
)
==
0
and
self
.
defaultTest
is
None
:
# createTests will load tests from self.module
self
.
testNames
=
None
elif
len
(
args
)
>
0
:
self
.
testNames
=
_convert_names
(
args
)
if
__name__
==
'__main__'
:
# to support python -m unittest ...
self
.
module
=
None
else
:
self
.
testNames
=
(
self
.
defaultTest
,)
self
.
createTests
()
except
getopt
.
error
as
msg
:
self
.
usageExit
(
msg
)
return
for
opt
,
value
in
options
:
if
opt
in
(
'-h'
,
'-H'
,
'--help'
):
self
.
usageExit
()
if
opt
in
(
'-q'
,
'--quiet'
):
self
.
verbosity
=
0
if
opt
in
(
'-v'
,
'--verbose'
):
self
.
verbosity
=
2
if
opt
in
(
'-f'
,
'--failfast'
):
if
self
.
failfast
is
None
:
self
.
failfast
=
True
# Should this raise an exception if -f is not valid?
if
opt
in
(
'-c'
,
'--catch'
):
if
self
.
catchbreak
is
None
:
self
.
catchbreak
=
True
# Should this raise an exception if -c is not valid?
if
opt
in
(
'-b'
,
'--buffer'
):
if
self
.
buffer
is
None
:
self
.
buffer
=
True
# Should this raise an exception if -b is not valid?
if
len
(
args
)
==
0
and
self
.
module
is
None
:
# this allows "python -m unittest -v" to still work for
# test discovery. This means -c / -b / -v / -f options will
# be handled twice, which is harmless but not ideal.
self
.
_do_discovery
(
argv
[
1
:])
return
if
len
(
args
)
==
0
and
self
.
defaultTest
is
None
:
# createTests will load tests from self.module
self
.
testNames
=
None
elif
len
(
args
)
>
0
:
self
.
testNames
=
_convert_names
(
args
)
if
__name__
==
'__main__'
:
# to support python -m unittest ...
self
.
module
=
None
else
:
self
.
testNames
=
(
self
.
defaultTest
,)
self
.
createTests
()
def
createTests
(
self
):
if
self
.
testNames
is
None
:
...
...
Lib/unittest/test/test_discovery.py
Dosyayı görüntüle @
f100dbd6
...
...
@@ -231,6 +231,19 @@ class TestDiscovery(unittest.TestCase):
program
.
parseArgs
([
'something'
])
self
.
assertTrue
(
self
.
called
)
def
test_command_line_handling_discover_by_default_with_options
(
self
):
program
=
TestableTestProgram
()
program
.
module
=
None
args
=
[
'something'
,
'-v'
,
'-b'
,
'-v'
,
'-c'
,
'-f'
]
self
.
called
=
False
def
do_discovery
(
argv
):
self
.
called
=
True
self
.
assertEqual
(
argv
,
args
[
1
:])
program
.
_do_discovery
=
do_discovery
program
.
parseArgs
(
args
)
self
.
assertTrue
(
self
.
called
)
def
test_command_line_handling_do_discovery_too_many_arguments
(
self
):
class
Stop
(
Exception
):
...
...
Lib/unittest/test/test_program.py
Dosyayı görüntüle @
f100dbd6
...
...
@@ -99,6 +99,7 @@ class InitialisableProgram(unittest.TestProgram):
defaultTest
=
None
testRunner
=
None
testLoader
=
unittest
.
defaultTestLoader
module
=
'__main__'
progName
=
'test'
test
=
'test'
def
__init__
(
self
,
*
args
):
...
...
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