Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(34301)

Side by Side Diff: Lib/test/test_gdb.py

Issue 16510: Using appropriate checks in tests
Patch Set: Created 5 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_gc.py ('k') | Lib/test/test_grammar.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Verify that gdb can pretty-print the various PyObject* types 1 # Verify that gdb can pretty-print the various PyObject* types
2 # 2 #
3 # The code for testing gdb was adapted from similar work in Unladen Swallow's 3 # The code for testing gdb was adapted from similar work in Unladen Swallow's
4 # Lib/test/test_jit_gdb.py 4 # Lib/test/test_jit_gdb.py
5 5
6 import os 6 import os
7 import re 7 import re
8 import pprint 8 import pprint
9 import subprocess 9 import subprocess
10 import sys 10 import sys
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 m = re.match(pattern, actual, re.DOTALL) 210 m = re.match(pattern, actual, re.DOTALL)
211 if not m: 211 if not m:
212 self.fail(msg='%r did not match %r' % (actual, pattern)) 212 self.fail(msg='%r did not match %r' % (actual, pattern))
213 213
214 def get_sample_script(self): 214 def get_sample_script(self):
215 return findfile('gdb_sample.py') 215 return findfile('gdb_sample.py')
216 216
217 class PrettyPrintTests(DebuggerTests): 217 class PrettyPrintTests(DebuggerTests):
218 def test_getting_backtrace(self): 218 def test_getting_backtrace(self):
219 gdb_output = self.get_stack_trace('id(42)') 219 gdb_output = self.get_stack_trace('id(42)')
220 self.assertTrue(BREAKPOINT_FN in gdb_output) 220 self.assertIn(BREAKPOINT_FN, gdb_output)
221 221
222 def assertGdbRepr(self, val, exp_repr=None, cmds_after_breakpoint=None): 222 def assertGdbRepr(self, val, exp_repr=None, cmds_after_breakpoint=None):
223 # Ensure that gdb's rendering of the value in a debugged process 223 # Ensure that gdb's rendering of the value in a debugged process
224 # matches repr(value) in this process: 224 # matches repr(value) in this process:
225 gdb_repr, gdb_output = self.get_gdb_repr('id(' + ascii(val) + ')', 225 gdb_repr, gdb_output = self.get_gdb_repr('id(' + ascii(val) + ')',
226 cmds_after_breakpoint) 226 cmds_after_breakpoint)
227 if not exp_repr: 227 if not exp_repr:
228 exp_repr = repr(val) 228 exp_repr = repr(val)
229 self.assertEqual(gdb_repr, exp_repr, 229 self.assertEqual(gdb_repr, exp_repr,
230 ('%r did not equal expected %r; full output was:\n%s' 230 ('%r did not equal expected %r; full output was:\n%s'
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 run_unittest(PrettyPrintTests, 851 run_unittest(PrettyPrintTests,
852 PyListTests, 852 PyListTests,
853 StackNavigationTests, 853 StackNavigationTests,
854 PyBtTests, 854 PyBtTests,
855 PyPrintTests, 855 PyPrintTests,
856 PyLocalsTests 856 PyLocalsTests
857 ) 857 )
858 858
859 if __name__ == "__main__": 859 if __name__ == "__main__":
860 test_main() 860 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_gc.py ('k') | Lib/test/test_grammar.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+