diff options
author | Victor Stinner <vstinner@python.org> | 2021-09-15 18:21:06 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-15 18:21:06 (GMT) |
commit | 84a6061e29e9dc13909bdf6f541f48c2a4f1d410 (patch) | |
tree | 7014282d2b1aa68f0ed54d961b6b7d57a105fbbb | |
parent | cc057ff5227b3a4ded637caa7ba51b67b06abaaa (diff) | |
download | cpython-84a6061e29e9dc13909bdf6f541f48c2a4f1d410.zip cpython-84a6061e29e9dc13909bdf6f541f48c2a4f1d410.tar.gz cpython-84a6061e29e9dc13909bdf6f541f48c2a4f1d410.tar.bz2 |
bpo-45207: Make test_gdb.test_pycfunction() quiet (GH-28355)
test_gdb.test_pycfunction() now ignores gdb stderr, it no longer logs
messages like:
Function "meth_varargs" not defined.
-rw-r--r-- | Lib/test/test_gdb.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py index 98b36d6..22a8cf3 100644 --- a/Lib/test/test_gdb.py +++ b/Lib/test/test_gdb.py @@ -145,7 +145,8 @@ class DebuggerTests(unittest.TestCase): def get_stack_trace(self, source=None, script=None, breakpoint=BREAKPOINT_FN, cmds_after_breakpoint=None, - import_site=False): + import_site=False, + ignore_stderr=False): ''' Run 'python -c SOURCE' under gdb with a breakpoint. @@ -224,8 +225,9 @@ class DebuggerTests(unittest.TestCase): # Use "args" to invoke gdb, capturing stdout, stderr: out, err = run_gdb(*args, PYTHONHASHSEED=PYTHONHASHSEED) - for line in err.splitlines(): - print(line, file=sys.stderr) + if not ignore_stderr: + for line in err.splitlines(): + print(line, file=sys.stderr) # bpo-34007: Sometimes some versions of the shared libraries that # are part of the traceback are compiled in optimised mode and the @@ -909,6 +911,9 @@ id(42) cmd, breakpoint=func_name, cmds_after_breakpoint=['bt', 'py-bt'], + # bpo-45207: Ignore 'Function "meth_varargs" not + # defined.' message in stderr. + ignore_stderr=True, ) self.assertIn(f'<built-in method {func_name}', gdb_output) @@ -917,6 +922,9 @@ id(42) cmd, breakpoint=func_name, cmds_after_breakpoint=['py-bt-full'], + # bpo-45207: Ignore 'Function "meth_varargs" not + # defined.' message in stderr. + ignore_stderr=True, ) self.assertIn( f'#{expected_frame} <built-in method {func_name}', |