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

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

Issue 16510: Using appropriate checks in tests
Patch Set: Created 5 years, 7 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 m = re.match(pattern, actual, re.DOTALL) 220 m = re.match(pattern, actual, re.DOTALL)
221 if not m: 221 if not m:
222 self.fail(msg='%r did not match %r' % (actual, pattern)) 222 self.fail(msg='%r did not match %r' % (actual, pattern))
223 223
224 def get_sample_script(self): 224 def get_sample_script(self):
225 return findfile('gdb_sample.py') 225 return findfile('gdb_sample.py')
226 226
227 class PrettyPrintTests(DebuggerTests): 227 class PrettyPrintTests(DebuggerTests):
228 def test_getting_backtrace(self): 228 def test_getting_backtrace(self):
229 gdb_output = self.get_stack_trace('id(42)') 229 gdb_output = self.get_stack_trace('id(42)')
230 self.assertTrue(BREAKPOINT_FN in gdb_output) 230 self.assertIn(BREAKPOINT_FN, gdb_output)
231 231
232 def assertGdbRepr(self, val, exp_repr=None): 232 def assertGdbRepr(self, val, exp_repr=None):
233 # Ensure that gdb's rendering of the value in a debugged process 233 # Ensure that gdb's rendering of the value in a debugged process
234 # matches repr(value) in this process: 234 # matches repr(value) in this process:
235 gdb_repr, gdb_output = self.get_gdb_repr('id(' + ascii(val) + ')') 235 gdb_repr, gdb_output = self.get_gdb_repr('id(' + ascii(val) + ')')
236 if not exp_repr: 236 if not exp_repr:
237 exp_repr = repr(val) 237 exp_repr = repr(val)
238 self.assertEqual(gdb_repr, exp_repr, 238 self.assertEqual(gdb_repr, exp_repr,
239 ('%r did not equal expected %r; full output was:\n%s' 239 ('%r did not equal expected %r; full output was:\n%s'
240 % (gdb_repr, exp_repr, gdb_output))) 240 % (gdb_repr, exp_repr, gdb_output)))
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 run_unittest(PrettyPrintTests, 859 run_unittest(PrettyPrintTests,
860 PyListTests, 860 PyListTests,
861 StackNavigationTests, 861 StackNavigationTests,
862 PyBtTests, 862 PyBtTests,
863 PyPrintTests, 863 PyPrintTests,
864 PyLocalsTests 864 PyLocalsTests
865 ) 865 )
866 866
867 if __name__ == "__main__": 867 if __name__ == "__main__":
868 test_main() 868 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+