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
0dad7556
Kaydet (Commit)
0dad7556
authored
May 20, 2016
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #27063: Some unittest loader tests were silently skipped.
üst
13e602ea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
26 deletions
+28
-26
test_loader.py
Lib/unittest/test/test_loader.py
+28
-26
No files found.
Lib/unittest/test/test_loader.py
Dosyayı görüntüle @
0dad7556
...
...
@@ -8,7 +8,7 @@ import unittest
# test isolation and reproducibility.
def
warningregistry
(
func
):
def
wrapper
(
*
args
,
**
kws
):
missing
=
object
()
missing
=
[]
saved
=
getattr
(
warnings
,
'__warningregistry__'
,
missing
)
.
copy
()
try
:
return
func
(
*
args
,
**
kws
)
...
...
@@ -20,6 +20,7 @@ def warningregistry(func):
pass
else
:
warnings
.
__warningregistry__
=
saved
return
wrapper
class
Test_TestLoader
(
unittest
.
TestCase
):
...
...
@@ -197,9 +198,9 @@ class Test_TestLoader(unittest.TestCase):
# ignored (and deprecated).
load_tests_args
=
[]
with
warnings
.
catch_warnings
(
record
=
False
):
warnings
.
simplefilter
(
'
never
'
)
warnings
.
simplefilter
(
'
ignore
'
)
suite
=
loader
.
loadTestsFromModule
(
m
,
use_load_tests
=
False
)
self
.
assertEqual
(
load_tests_args
,
[
loader
,
suite
,
None
])
self
.
assertEqual
(
load_tests_args
,
[
loader
,
suite
,
None
])
@warningregistry
def
test_loadTestsFromModule__use_load_tests_deprecated_positional
(
self
):
...
...
@@ -221,10 +222,10 @@ class Test_TestLoader(unittest.TestCase):
with
warnings
.
catch_warnings
(
record
=
True
)
as
w
:
warnings
.
simplefilter
(
'always'
)
suite
=
loader
.
loadTestsFromModule
(
m
,
False
)
self
.
assertIsInstance
(
suite
,
unittest
.
TestSuite
)
# load_tests was still called because use_load_tests is deprecated
# and ignored.
self
.
assertEqual
(
load_tests_args
,
[
loader
,
suite
,
None
])
self
.
assertIsInstance
(
suite
,
unittest
.
TestSuite
)
# load_tests was still called because use_load_tests is deprecated
# and ignored.
self
.
assertEqual
(
load_tests_args
,
[
loader
,
suite
,
None
])
# We got a warning.
self
.
assertIs
(
w
[
-
1
]
.
category
,
DeprecationWarning
)
self
.
assertEqual
(
str
(
w
[
-
1
]
.
message
),
...
...
@@ -249,14 +250,14 @@ class Test_TestLoader(unittest.TestCase):
with
warnings
.
catch_warnings
(
record
=
True
)
as
w
:
warnings
.
simplefilter
(
'always'
)
suite
=
loader
.
loadTestsFromModule
(
m
,
use_load_tests
=
False
)
self
.
assertIsInstance
(
suite
,
unittest
.
TestSuite
)
# load_tests was still called because use_load_tests is deprecated
# and ignored.
self
.
assertEqual
(
load_tests_args
,
[
loader
,
suite
,
None
])
# We got a warning.
self
.
assertIs
(
w
[
-
1
]
.
category
,
DeprecationWarning
)
self
.
assertEqual
(
str
(
w
[
-
1
]
.
message
),
'use_load_tests is deprecated and ignored'
)
self
.
assertIsInstance
(
suite
,
unittest
.
TestSuite
)
# load_tests was still called because use_load_tests is deprecated
# and ignored.
self
.
assertEqual
(
load_tests_args
,
[
loader
,
suite
,
None
])
# We got a warning.
self
.
assertIs
(
w
[
-
1
]
.
category
,
DeprecationWarning
)
self
.
assertEqual
(
str
(
w
[
-
1
]
.
message
),
'use_load_tests is deprecated and ignored'
)
@warningregistry
def
test_loadTestsFromModule__too_many_positional_args
(
self
):
...
...
@@ -274,17 +275,18 @@ class Test_TestLoader(unittest.TestCase):
m
.
load_tests
=
load_tests
loader
=
unittest
.
TestLoader
()
with
self
.
assertRaises
(
TypeError
)
as
cm
,
\
warnings
.
catch_warning
(
record
=
True
)
as
w
:
warnings
.
catch_warnings
(
record
=
True
)
as
w
:
warnings
.
simplefilter
(
'always'
)
loader
.
loadTestsFromModule
(
m
,
False
,
'testme.*'
)
# We still got the deprecation warning.
self
.
assertIs
(
w
[
-
1
]
.
category
,
DeprecationWarning
)
self
.
assertEqual
(
str
(
w
[
-
1
]
.
message
),
'use_load_tests is deprecated and ignored'
)
# We also got a TypeError for too many positional arguments.
self
.
assertEqual
(
type
(
cm
.
exception
),
TypeError
)
self
.
assertEqual
(
str
(
cm
.
exception
),
'loadTestsFromModule() takes 1 positional argument but 3 were given'
)
# We still got the deprecation warning.
self
.
assertIs
(
w
[
-
1
]
.
category
,
DeprecationWarning
)
self
.
assertEqual
(
str
(
w
[
-
1
]
.
message
),
'use_load_tests is deprecated and ignored'
)
# We also got a TypeError for too many positional arguments.
self
.
assertEqual
(
type
(
cm
.
exception
),
TypeError
)
self
.
assertEqual
(
str
(
cm
.
exception
),
'loadTestsFromModule() takes 1 positional argument but 3 were given'
)
@warningregistry
def
test_loadTestsFromModule__use_load_tests_other_bad_keyword
(
self
):
...
...
@@ -302,7 +304,7 @@ class Test_TestLoader(unittest.TestCase):
m
.
load_tests
=
load_tests
loader
=
unittest
.
TestLoader
()
with
warnings
.
catch_warnings
():
warnings
.
simplefilter
(
'
never
'
)
warnings
.
simplefilter
(
'
ignore
'
)
with
self
.
assertRaises
(
TypeError
)
as
cm
:
loader
.
loadTestsFromModule
(
m
,
use_load_tests
=
False
,
very_bad
=
True
,
worse
=
False
)
...
...
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