mirror of
https://github.com/python/cpython.git
synced 2024-11-24 00:38:00 +01:00
Issue #23883: Add missing entries to traceback.__all__.
This commit is contained in:
parent
cb6fdf2c63
commit
716b3d3e91
@ -6,8 +6,7 @@ import linecache
|
||||
import sys
|
||||
import unittest
|
||||
import re
|
||||
from test.support import run_unittest, Error, captured_output
|
||||
from test.support import TESTFN, unlink, cpython_only
|
||||
from test.support import TESTFN, Error, captured_output, unlink, cpython_only
|
||||
from test.script_helper import assert_python_ok
|
||||
import textwrap
|
||||
|
||||
@ -593,7 +592,7 @@ class TestStack(unittest.TestCase):
|
||||
traceback.walk_stack(None), capture_locals=True, limit=1)
|
||||
s = some_inner(3, 4)
|
||||
self.assertEqual(
|
||||
[' File "' + __file__ + '", line 593, '
|
||||
[' File "' + __file__ + '", line 592, '
|
||||
'in some_inner\n'
|
||||
' traceback.walk_stack(None), capture_locals=True, limit=1)\n'
|
||||
' a = 1\n'
|
||||
@ -603,7 +602,6 @@ class TestStack(unittest.TestCase):
|
||||
], s.format())
|
||||
|
||||
|
||||
|
||||
class TestTracebackException(unittest.TestCase):
|
||||
|
||||
def test_smoke(self):
|
||||
@ -732,8 +730,19 @@ class TestTracebackException(unittest.TestCase):
|
||||
self.assertEqual(exc.stack[0].locals, None)
|
||||
|
||||
|
||||
def test_main():
|
||||
run_unittest(__name__)
|
||||
class MiscTest(unittest.TestCase):
|
||||
|
||||
def test_all(self):
|
||||
expected = set()
|
||||
blacklist = {'print_list'}
|
||||
for name in dir(traceback):
|
||||
if name.startswith('_') or name in blacklist:
|
||||
continue
|
||||
module_object = getattr(traceback, name)
|
||||
if getattr(module_object, '__module__', None) == 'traceback':
|
||||
expected.add(name)
|
||||
self.assertCountEqual(traceback.__all__, expected)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_main()
|
||||
unittest.main()
|
||||
|
@ -7,8 +7,9 @@ import operator
|
||||
__all__ = ['extract_stack', 'extract_tb', 'format_exception',
|
||||
'format_exception_only', 'format_list', 'format_stack',
|
||||
'format_tb', 'print_exc', 'format_exc', 'print_exception',
|
||||
'print_last', 'print_stack', 'print_tb',
|
||||
'clear_frames']
|
||||
'print_last', 'print_stack', 'print_tb', 'clear_frames',
|
||||
'FrameSummary', 'StackSummary', 'TracebackException',
|
||||
'walk_stack', 'walk_tb']
|
||||
|
||||
#
|
||||
# Formatting and printing lists of traceback lines.
|
||||
|
Loading…
Reference in New Issue
Block a user