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
b1aa30f9
Kaydet (Commit)
b1aa30f9
authored
Mar 22, 2010
tarafından
Michael Foord
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue 7815. __unittest in module globals trims frames from reported stacktraces in unittest.
üst
bb9d7263
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
32 additions
and
5 deletions
+32
-5
test_unittest.py
Lib/test/test_unittest.py
+10
-0
__init__.py
Lib/unittest/__init__.py
+2
-0
__main__.py
Lib/unittest/__main__.py
+3
-0
case.py
Lib/unittest/case.py
+3
-0
loader.py
Lib/unittest/loader.py
+2
-0
main.py
Lib/unittest/main.py
+2
-0
result.py
Lib/unittest/result.py
+3
-5
runner.py
Lib/unittest/runner.py
+2
-0
suite.py
Lib/unittest/suite.py
+2
-0
util.py
Lib/unittest/util.py
+3
-0
No files found.
Lib/test/test_unittest.py
Dosyayı görüntüle @
b1aa30f9
...
@@ -2084,6 +2084,16 @@ class Test_TestResult(TestCase):
...
@@ -2084,6 +2084,16 @@ class Test_TestResult(TestCase):
'Tests getDescription() for a method with a longer '
'Tests getDescription() for a method with a longer '
'docstring.'
))
'docstring.'
))
def
testStackFrameTrimming
(
self
):
class
Frame
(
object
):
class
tb_frame
(
object
):
f_globals
=
{}
result
=
unittest
.
TestResult
()
self
.
assertFalse
(
result
.
_is_relevant_tb_level
(
Frame
))
Frame
.
tb_frame
.
f_globals
[
'__unittest'
]
=
True
self
.
assertTrue
(
result
.
_is_relevant_tb_level
(
Frame
))
classDict
=
dict
(
unittest
.
TestResult
.
__dict__
)
classDict
=
dict
(
unittest
.
TestResult
.
__dict__
)
for
m
in
(
'addSkip'
,
'addExpectedFailure'
,
'addUnexpectedSuccess'
,
for
m
in
(
'addSkip'
,
'addExpectedFailure'
,
'addUnexpectedSuccess'
,
'__init__'
):
'__init__'
):
...
...
Lib/unittest/__init__.py
Dosyayı görüntüle @
b1aa30f9
...
@@ -64,3 +64,5 @@ from .runner import TextTestRunner, TextTestResult
...
@@ -64,3 +64,5 @@ from .runner import TextTestRunner, TextTestResult
# deprecated
# deprecated
_TextTestResult
=
TextTestResult
_TextTestResult
=
TextTestResult
__unittest
=
True
Lib/unittest/__main__.py
Dosyayı görüntüle @
b1aa30f9
...
@@ -4,5 +4,8 @@ import sys
...
@@ -4,5 +4,8 @@ import sys
if
sys
.
argv
[
0
]
.
endswith
(
"__main__.py"
):
if
sys
.
argv
[
0
]
.
endswith
(
"__main__.py"
):
sys
.
argv
[
0
]
=
"unittest"
sys
.
argv
[
0
]
=
"unittest"
__unittest
=
True
from
.main
import
main
from
.main
import
main
main
(
module
=
None
)
main
(
module
=
None
)
Lib/unittest/case.py
Dosyayı görüntüle @
b1aa30f9
...
@@ -12,6 +12,9 @@ from .util import (
...
@@ -12,6 +12,9 @@ from .util import (
strclass
,
safe_repr
,
sorted_list_difference
,
unorderable_list_difference
strclass
,
safe_repr
,
sorted_list_difference
,
unorderable_list_difference
)
)
__unittest
=
True
class
SkipTest
(
Exception
):
class
SkipTest
(
Exception
):
"""
"""
Raise this exception in a test to skip it.
Raise this exception in a test to skip it.
...
...
Lib/unittest/loader.py
Dosyayı görüntüle @
b1aa30f9
...
@@ -10,6 +10,8 @@ from fnmatch import fnmatch
...
@@ -10,6 +10,8 @@ from fnmatch import fnmatch
from
.
import
case
,
suite
from
.
import
case
,
suite
__unittest
=
True
def
_CmpToKey
(
mycmp
):
def
_CmpToKey
(
mycmp
):
'Convert a cmp= function into a key= function'
'Convert a cmp= function into a key= function'
...
...
Lib/unittest/main.py
Dosyayı görüntüle @
b1aa30f9
...
@@ -6,6 +6,8 @@ import types
...
@@ -6,6 +6,8 @@ import types
from
.
import
loader
,
runner
from
.
import
loader
,
runner
__unittest
=
True
USAGE_AS_MAIN
=
"""
\
USAGE_AS_MAIN
=
"""
\
Usage:
%(progName)
s [options] [tests]
Usage:
%(progName)
s [options] [tests]
...
...
Lib/unittest/result.py
Dosyayı görüntüle @
b1aa30f9
...
@@ -4,6 +4,8 @@ import traceback
...
@@ -4,6 +4,8 @@ import traceback
from
.
import
util
from
.
import
util
__unittest
=
True
class
TestResult
(
object
):
class
TestResult
(
object
):
"""Holder for test result information.
"""Holder for test result information.
...
@@ -98,11 +100,7 @@ class TestResult(object):
...
@@ -98,11 +100,7 @@ class TestResult(object):
return
''
.
join
(
traceback
.
format_exception
(
exctype
,
value
,
tb
))
return
''
.
join
(
traceback
.
format_exception
(
exctype
,
value
,
tb
))
def
_is_relevant_tb_level
(
self
,
tb
):
def
_is_relevant_tb_level
(
self
,
tb
):
globs
=
tb
.
tb_frame
.
f_globals
return
'__unittest'
in
tb
.
tb_frame
.
f_globals
is_relevant
=
'__name__'
in
globs
and
\
globs
[
"__name__"
]
.
startswith
(
"unittest"
)
del
globs
return
is_relevant
def
_count_relevant_tb_levels
(
self
,
tb
):
def
_count_relevant_tb_levels
(
self
,
tb
):
length
=
0
length
=
0
...
...
Lib/unittest/runner.py
Dosyayı görüntüle @
b1aa30f9
...
@@ -5,6 +5,8 @@ import time
...
@@ -5,6 +5,8 @@ import time
from
.
import
result
from
.
import
result
__unittest
=
True
class
_WritelnDecorator
(
object
):
class
_WritelnDecorator
(
object
):
"""Used to decorate file-like objects with a handy 'writeln' method"""
"""Used to decorate file-like objects with a handy 'writeln' method"""
...
...
Lib/unittest/suite.py
Dosyayı görüntüle @
b1aa30f9
...
@@ -5,6 +5,8 @@ import sys
...
@@ -5,6 +5,8 @@ import sys
from
.
import
case
from
.
import
case
from
.
import
util
from
.
import
util
__unittest
=
True
class
BaseTestSuite
(
object
):
class
BaseTestSuite
(
object
):
"""A simple test suite that doesn't provide class or module shared fixtures.
"""A simple test suite that doesn't provide class or module shared fixtures.
...
...
Lib/unittest/util.py
Dosyayı görüntüle @
b1aa30f9
"""Various utility functions."""
"""Various utility functions."""
__unittest
=
True
def
safe_repr
(
obj
):
def
safe_repr
(
obj
):
try
:
try
:
return
repr
(
obj
)
return
repr
(
obj
)
...
...
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