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

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

Issue 16510: Using appropriate checks in tests
Patch Set: Created 6 years 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 subprocess 8 import subprocess
9 import sys 9 import sys
10 import sysconfig 10 import sysconfig
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 m = re.match(pattern, actual, re.DOTALL) 203 m = re.match(pattern, actual, re.DOTALL)
204 if not m: 204 if not m:
205 self.fail(msg='%r did not match %r' % (actual, pattern)) 205 self.fail(msg='%r did not match %r' % (actual, pattern))
206 206
207 def get_sample_script(self): 207 def get_sample_script(self):
208 return findfile('gdb_sample.py') 208 return findfile('gdb_sample.py')
209 209
210 class PrettyPrintTests(DebuggerTests): 210 class PrettyPrintTests(DebuggerTests):
211 def test_getting_backtrace(self): 211 def test_getting_backtrace(self):
212 gdb_output = self.get_stack_trace('id(42)') 212 gdb_output = self.get_stack_trace('id(42)')
213 self.assertTrue(BREAKPOINT_FN in gdb_output) 213 self.assertIn(BREAKPOINT_FN, gdb_output)
214 214
215 def assertGdbRepr(self, val, exp_repr=None, cmds_after_breakpoint=None): 215 def assertGdbRepr(self, val, exp_repr=None, cmds_after_breakpoint=None):
216 # Ensure that gdb's rendering of the value in a debugged process 216 # Ensure that gdb's rendering of the value in a debugged process
217 # matches repr(value) in this process: 217 # matches repr(value) in this process:
218 gdb_repr, gdb_output = self.get_gdb_repr('id(' + ascii(val) + ')', 218 gdb_repr, gdb_output = self.get_gdb_repr('id(' + ascii(val) + ')',
219 cmds_after_breakpoint) 219 cmds_after_breakpoint)
220 if not exp_repr: 220 if not exp_repr:
221 exp_repr = repr(val) 221 exp_repr = repr(val)
222 self.assertEqual(gdb_repr, exp_repr, 222 self.assertEqual(gdb_repr, exp_repr,
223 ('%r did not equal expected %r; full output was:\n%s' 223 ('%r did not equal expected %r; full output was:\n%s'
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 run_unittest(PrettyPrintTests, 836 run_unittest(PrettyPrintTests,
837 PyListTests, 837 PyListTests,
838 StackNavigationTests, 838 StackNavigationTests,
839 PyBtTests, 839 PyBtTests,
840 PyPrintTests, 840 PyPrintTests,
841 PyLocalsTests 841 PyLocalsTests
842 ) 842 )
843 843
844 if __name__ == "__main__": 844 if __name__ == "__main__":
845 test_main() 845 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+