blob: c39cc97fe1de0c464c3717822158f3c47e3bb054 [file] [log] [blame]
Georg Brandl46b9afc2010-07-30 09:14:20 +00001# A test suite for pdb; not very comprehensive at the moment.
Martin v. Löwis67880cc2012-05-02 07:41:22 +02002
Andrew Svetlovf0efea02013-03-18 10:09:50 -07003import doctest
Łukasz Langa2eb6eca2016-09-09 22:21:17 -07004import os
Georg Brandl6cccb862010-07-30 14:16:43 +00005import pdb
Georg Brandl243ad662009-05-05 09:00:19 +00006import sys
Łukasz Langa2eb6eca2016-09-09 22:21:17 -07007import tempfile
Brett Cannon9529fbf2013-06-15 17:11:25 -04008import types
Georg Brandl6cccb862010-07-30 14:16:43 +00009import unittest
10import subprocess
Senthil Kumaran42d70812012-05-01 10:07:49 +080011import textwrap
Georg Brandl243ad662009-05-05 09:00:19 +000012
13from test import support
14# This little helper class is essential for testing pdb under doctest.
15from test.test_doctest import _FakeInput
16
17
Georg Brandl9fa2e022009-09-16 16:40:45 +000018class PdbTestInput(object):
19 """Context manager that makes testing Pdb in doctests easier."""
20
21 def __init__(self, input):
22 self.input = input
23
24 def __enter__(self):
25 self.real_stdin = sys.stdin
26 sys.stdin = _FakeInput(self.input)
Brett Cannon31f59292011-02-21 19:29:56 +000027 self.orig_trace = sys.gettrace() if hasattr(sys, 'gettrace') else None
Georg Brandl9fa2e022009-09-16 16:40:45 +000028
29 def __exit__(self, *exc):
30 sys.stdin = self.real_stdin
Brett Cannon31f59292011-02-21 19:29:56 +000031 if self.orig_trace:
32 sys.settrace(self.orig_trace)
Georg Brandl9fa2e022009-09-16 16:40:45 +000033
34
35def test_pdb_displayhook():
36 """This tests the custom displayhook for pdb.
37
38 >>> def test_function(foo, bar):
Łukasz Langa2eb6eca2016-09-09 22:21:17 -070039 ... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
Georg Brandl9fa2e022009-09-16 16:40:45 +000040 ... pass
41
42 >>> with PdbTestInput([
43 ... 'foo',
44 ... 'bar',
45 ... 'for i in range(5): print(i)',
46 ... 'continue',
47 ... ]):
48 ... test_function(1, None)
49 > <doctest test.test_pdb.test_pdb_displayhook[0]>(3)test_function()
50 -> pass
51 (Pdb) foo
52 1
53 (Pdb) bar
54 (Pdb) for i in range(5): print(i)
55 0
56 1
57 2
58 3
59 4
60 (Pdb) continue
61 """
62
63
Georg Brandl0d089622010-07-30 16:00:46 +000064def test_pdb_basic_commands():
65 """Test the basic commands of pdb.
66
67 >>> def test_function_2(foo, bar='default'):
68 ... print(foo)
69 ... for i in range(5):
70 ... print(i)
71 ... print(bar)
72 ... for i in range(10):
73 ... never_executed
74 ... print('after for')
75 ... print('...')
76 ... return foo.upper()
77
78 >>> def test_function():
Łukasz Langa2eb6eca2016-09-09 22:21:17 -070079 ... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
Georg Brandl0d089622010-07-30 16:00:46 +000080 ... ret = test_function_2('baz')
81 ... print(ret)
82
83 >>> with PdbTestInput([ # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
84 ... 'step', # entering the function call
85 ... 'args', # display function args
86 ... 'list', # list function source
87 ... 'bt', # display backtrace
88 ... 'up', # step up to test_function()
89 ... 'down', # step down to test_function_2() again
90 ... 'next', # stepping to print(foo)
91 ... 'next', # stepping to the for loop
92 ... 'step', # stepping into the for loop
93 ... 'until', # continuing until out of the for loop
94 ... 'next', # executing the print(bar)
95 ... 'jump 8', # jump over second for loop
96 ... 'return', # return out of function
97 ... 'retval', # display return value
98 ... 'continue',
99 ... ]):
100 ... test_function()
101 > <doctest test.test_pdb.test_pdb_basic_commands[1]>(3)test_function()
102 -> ret = test_function_2('baz')
103 (Pdb) step
104 --Call--
105 > <doctest test.test_pdb.test_pdb_basic_commands[0]>(1)test_function_2()
106 -> def test_function_2(foo, bar='default'):
107 (Pdb) args
108 foo = 'baz'
109 bar = 'default'
110 (Pdb) list
111 1 -> def test_function_2(foo, bar='default'):
112 2 print(foo)
113 3 for i in range(5):
114 4 print(i)
115 5 print(bar)
116 6 for i in range(10):
117 7 never_executed
118 8 print('after for')
119 9 print('...')
120 10 return foo.upper()
121 [EOF]
122 (Pdb) bt
123 ...
124 <doctest test.test_pdb.test_pdb_basic_commands[2]>(18)<module>()
125 -> test_function()
126 <doctest test.test_pdb.test_pdb_basic_commands[1]>(3)test_function()
127 -> ret = test_function_2('baz')
128 > <doctest test.test_pdb.test_pdb_basic_commands[0]>(1)test_function_2()
129 -> def test_function_2(foo, bar='default'):
130 (Pdb) up
131 > <doctest test.test_pdb.test_pdb_basic_commands[1]>(3)test_function()
132 -> ret = test_function_2('baz')
133 (Pdb) down
134 > <doctest test.test_pdb.test_pdb_basic_commands[0]>(1)test_function_2()
135 -> def test_function_2(foo, bar='default'):
136 (Pdb) next
137 > <doctest test.test_pdb.test_pdb_basic_commands[0]>(2)test_function_2()
138 -> print(foo)
139 (Pdb) next
140 baz
141 > <doctest test.test_pdb.test_pdb_basic_commands[0]>(3)test_function_2()
142 -> for i in range(5):
143 (Pdb) step
144 > <doctest test.test_pdb.test_pdb_basic_commands[0]>(4)test_function_2()
145 -> print(i)
146 (Pdb) until
147 0
148 1
149 2
150 3
151 4
152 > <doctest test.test_pdb.test_pdb_basic_commands[0]>(5)test_function_2()
153 -> print(bar)
154 (Pdb) next
155 default
156 > <doctest test.test_pdb.test_pdb_basic_commands[0]>(6)test_function_2()
157 -> for i in range(10):
158 (Pdb) jump 8
159 > <doctest test.test_pdb.test_pdb_basic_commands[0]>(8)test_function_2()
160 -> print('after for')
161 (Pdb) return
162 after for
163 ...
164 --Return--
165 > <doctest test.test_pdb.test_pdb_basic_commands[0]>(10)test_function_2()->'BAZ'
166 -> return foo.upper()
167 (Pdb) retval
168 'BAZ'
169 (Pdb) continue
170 BAZ
171 """
172
173
174def test_pdb_breakpoint_commands():
175 """Test basic commands related to breakpoints.
176
177 >>> def test_function():
Łukasz Langa2eb6eca2016-09-09 22:21:17 -0700178 ... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
Georg Brandl0d089622010-07-30 16:00:46 +0000179 ... print(1)
180 ... print(2)
181 ... print(3)
182 ... print(4)
183
184 First, need to clear bdb state that might be left over from previous tests.
185 Otherwise, the new breakpoints might get assigned different numbers.
186
187 >>> from bdb import Breakpoint
188 >>> Breakpoint.next = 1
189 >>> Breakpoint.bplist = {}
190 >>> Breakpoint.bpbynumber = [None]
191
192 Now test the breakpoint commands. NORMALIZE_WHITESPACE is needed because
193 the breakpoint list outputs a tab for the "stop only" and "ignore next"
194 lines, which we don't want to put in here.
195
196 >>> with PdbTestInput([ # doctest: +NORMALIZE_WHITESPACE
197 ... 'break 3',
198 ... 'disable 1',
199 ... 'ignore 1 10',
200 ... 'condition 1 1 < 2',
201 ... 'break 4',
Senthil Kumaran6f107042010-11-29 11:54:17 +0000202 ... 'break 4',
203 ... 'break',
204 ... 'clear 3',
Georg Brandl0d089622010-07-30 16:00:46 +0000205 ... 'break',
206 ... 'condition 1',
207 ... 'enable 1',
208 ... 'clear 1',
209 ... 'commands 2',
R David Murray78d692f2013-10-10 17:23:26 -0400210 ... 'p "42"',
211 ... 'print("42", 7*6)', # Issue 18764 (not about breakpoints)
Georg Brandl0d089622010-07-30 16:00:46 +0000212 ... 'end',
213 ... 'continue', # will stop at breakpoint 2 (line 4)
214 ... 'clear', # clear all!
215 ... 'y',
216 ... 'tbreak 5',
217 ... 'continue', # will stop at temporary breakpoint
218 ... 'break', # make sure breakpoint is gone
219 ... 'continue',
220 ... ]):
221 ... test_function()
222 > <doctest test.test_pdb.test_pdb_breakpoint_commands[0]>(3)test_function()
223 -> print(1)
224 (Pdb) break 3
225 Breakpoint 1 at <doctest test.test_pdb.test_pdb_breakpoint_commands[0]>:3
226 (Pdb) disable 1
227 Disabled breakpoint 1 at <doctest test.test_pdb.test_pdb_breakpoint_commands[0]>:3
228 (Pdb) ignore 1 10
229 Will ignore next 10 crossings of breakpoint 1.
230 (Pdb) condition 1 1 < 2
231 New condition set for breakpoint 1.
232 (Pdb) break 4
233 Breakpoint 2 at <doctest test.test_pdb.test_pdb_breakpoint_commands[0]>:4
Senthil Kumaran6f107042010-11-29 11:54:17 +0000234 (Pdb) break 4
235 Breakpoint 3 at <doctest test.test_pdb.test_pdb_breakpoint_commands[0]>:4
236 (Pdb) break
237 Num Type Disp Enb Where
238 1 breakpoint keep no at <doctest test.test_pdb.test_pdb_breakpoint_commands[0]>:3
239 stop only if 1 < 2
240 ignore next 10 hits
241 2 breakpoint keep yes at <doctest test.test_pdb.test_pdb_breakpoint_commands[0]>:4
242 3 breakpoint keep yes at <doctest test.test_pdb.test_pdb_breakpoint_commands[0]>:4
243 (Pdb) clear 3
244 Deleted breakpoint 3 at <doctest test.test_pdb.test_pdb_breakpoint_commands[0]>:4
Georg Brandl0d089622010-07-30 16:00:46 +0000245 (Pdb) break
246 Num Type Disp Enb Where
247 1 breakpoint keep no at <doctest test.test_pdb.test_pdb_breakpoint_commands[0]>:3
248 stop only if 1 < 2
249 ignore next 10 hits
250 2 breakpoint keep yes at <doctest test.test_pdb.test_pdb_breakpoint_commands[0]>:4
251 (Pdb) condition 1
252 Breakpoint 1 is now unconditional.
253 (Pdb) enable 1
254 Enabled breakpoint 1 at <doctest test.test_pdb.test_pdb_breakpoint_commands[0]>:3
255 (Pdb) clear 1
256 Deleted breakpoint 1 at <doctest test.test_pdb.test_pdb_breakpoint_commands[0]>:3
257 (Pdb) commands 2
R David Murray78d692f2013-10-10 17:23:26 -0400258 (com) p "42"
259 (com) print("42", 7*6)
Georg Brandl0d089622010-07-30 16:00:46 +0000260 (com) end
261 (Pdb) continue
262 1
R David Murray78d692f2013-10-10 17:23:26 -0400263 '42'
264 42 42
Georg Brandl0d089622010-07-30 16:00:46 +0000265 > <doctest test.test_pdb.test_pdb_breakpoint_commands[0]>(4)test_function()
266 -> print(2)
267 (Pdb) clear
268 Clear all breaks? y
269 Deleted breakpoint 2 at <doctest test.test_pdb.test_pdb_breakpoint_commands[0]>:4
270 (Pdb) tbreak 5
Senthil Kumaran6f107042010-11-29 11:54:17 +0000271 Breakpoint 4 at <doctest test.test_pdb.test_pdb_breakpoint_commands[0]>:5
Georg Brandl0d089622010-07-30 16:00:46 +0000272 (Pdb) continue
273 2
Senthil Kumaran6f107042010-11-29 11:54:17 +0000274 Deleted breakpoint 4 at <doctest test.test_pdb.test_pdb_breakpoint_commands[0]>:5
Georg Brandl0d089622010-07-30 16:00:46 +0000275 > <doctest test.test_pdb.test_pdb_breakpoint_commands[0]>(5)test_function()
276 -> print(3)
277 (Pdb) break
278 (Pdb) continue
279 3
280 4
281 """
282
283
Georg Brandle59ca2a2010-07-30 17:04:28 +0000284def do_nothing():
285 pass
286
287def do_something():
288 print(42)
289
290def test_list_commands():
291 """Test the list and source commands of pdb.
292
293 >>> def test_function_2(foo):
Georg Brandla8fbc6a2010-07-31 11:52:46 +0000294 ... import test.test_pdb
295 ... test.test_pdb.do_nothing()
Georg Brandle59ca2a2010-07-30 17:04:28 +0000296 ... 'some...'
297 ... 'more...'
298 ... 'code...'
299 ... 'to...'
300 ... 'make...'
301 ... 'a...'
302 ... 'long...'
303 ... 'listing...'
304 ... 'useful...'
305 ... '...'
306 ... '...'
307 ... return foo
308
309 >>> def test_function():
Łukasz Langa2eb6eca2016-09-09 22:21:17 -0700310 ... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
Georg Brandle59ca2a2010-07-30 17:04:28 +0000311 ... ret = test_function_2('baz')
312
313 >>> with PdbTestInput([ # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
314 ... 'list', # list first function
315 ... 'step', # step into second function
316 ... 'list', # list second function
317 ... 'list', # continue listing to EOF
318 ... 'list 1,3', # list specific lines
319 ... 'list x', # invalid argument
320 ... 'next', # step to import
321 ... 'next', # step over import
322 ... 'step', # step into do_nothing
323 ... 'longlist', # list all lines
324 ... 'source do_something', # list all lines of function
Georg Brandlcdf66a92010-07-30 18:15:16 +0000325 ... 'source fooxxx', # something that doesn't exit
Georg Brandle59ca2a2010-07-30 17:04:28 +0000326 ... 'continue',
327 ... ]):
328 ... test_function()
329 > <doctest test.test_pdb.test_list_commands[1]>(3)test_function()
330 -> ret = test_function_2('baz')
331 (Pdb) list
332 1 def test_function():
Łukasz Langa2eb6eca2016-09-09 22:21:17 -0700333 2 import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
Georg Brandle59ca2a2010-07-30 17:04:28 +0000334 3 -> ret = test_function_2('baz')
335 [EOF]
336 (Pdb) step
337 --Call--
338 > <doctest test.test_pdb.test_list_commands[0]>(1)test_function_2()
339 -> def test_function_2(foo):
340 (Pdb) list
341 1 -> def test_function_2(foo):
Georg Brandla8fbc6a2010-07-31 11:52:46 +0000342 2 import test.test_pdb
343 3 test.test_pdb.do_nothing()
Georg Brandle59ca2a2010-07-30 17:04:28 +0000344 4 'some...'
345 5 'more...'
346 6 'code...'
347 7 'to...'
348 8 'make...'
349 9 'a...'
350 10 'long...'
351 11 'listing...'
352 (Pdb) list
353 12 'useful...'
354 13 '...'
355 14 '...'
356 15 return foo
357 [EOF]
358 (Pdb) list 1,3
359 1 -> def test_function_2(foo):
Georg Brandla8fbc6a2010-07-31 11:52:46 +0000360 2 import test.test_pdb
361 3 test.test_pdb.do_nothing()
Georg Brandle59ca2a2010-07-30 17:04:28 +0000362 (Pdb) list x
363 *** ...
364 (Pdb) next
365 > <doctest test.test_pdb.test_list_commands[0]>(2)test_function_2()
Georg Brandla8fbc6a2010-07-31 11:52:46 +0000366 -> import test.test_pdb
Georg Brandle59ca2a2010-07-30 17:04:28 +0000367 (Pdb) next
368 > <doctest test.test_pdb.test_list_commands[0]>(3)test_function_2()
Georg Brandla8fbc6a2010-07-31 11:52:46 +0000369 -> test.test_pdb.do_nothing()
Georg Brandle59ca2a2010-07-30 17:04:28 +0000370 (Pdb) step
371 --Call--
Georg Brandle1e8df12010-07-31 08:14:16 +0000372 > ...test_pdb.py(...)do_nothing()
Georg Brandle59ca2a2010-07-30 17:04:28 +0000373 -> def do_nothing():
374 (Pdb) longlist
375 ... -> def do_nothing():
376 ... pass
377 (Pdb) source do_something
378 ... def do_something():
379 ... print(42)
Georg Brandlcdf66a92010-07-30 18:15:16 +0000380 (Pdb) source fooxxx
381 *** ...
Georg Brandle59ca2a2010-07-30 17:04:28 +0000382 (Pdb) continue
383 """
384
385
Georg Brandl0a9c3e92010-07-30 18:46:38 +0000386def test_post_mortem():
387 """Test post mortem traceback debugging.
388
389 >>> def test_function_2():
390 ... try:
391 ... 1/0
392 ... finally:
393 ... print('Exception!')
394
395 >>> def test_function():
Łukasz Langa2eb6eca2016-09-09 22:21:17 -0700396 ... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
Georg Brandl0a9c3e92010-07-30 18:46:38 +0000397 ... test_function_2()
398 ... print('Not reached.')
399
400 >>> with PdbTestInput([ # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
401 ... 'next', # step over exception-raising call
402 ... 'bt', # get a backtrace
403 ... 'list', # list code of test_function()
404 ... 'down', # step into test_function_2()
405 ... 'list', # list code of test_function_2()
406 ... 'continue',
407 ... ]):
408 ... try:
409 ... test_function()
410 ... except ZeroDivisionError:
411 ... print('Correctly reraised.')
412 > <doctest test.test_pdb.test_post_mortem[1]>(3)test_function()
413 -> test_function_2()
414 (Pdb) next
415 Exception!
416 ZeroDivisionError: division by zero
417 > <doctest test.test_pdb.test_post_mortem[1]>(3)test_function()
418 -> test_function_2()
419 (Pdb) bt
420 ...
421 <doctest test.test_pdb.test_post_mortem[2]>(10)<module>()
422 -> test_function()
423 > <doctest test.test_pdb.test_post_mortem[1]>(3)test_function()
424 -> test_function_2()
425 <doctest test.test_pdb.test_post_mortem[0]>(3)test_function_2()
426 -> 1/0
427 (Pdb) list
428 1 def test_function():
Łukasz Langa2eb6eca2016-09-09 22:21:17 -0700429 2 import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
Georg Brandl0a9c3e92010-07-30 18:46:38 +0000430 3 -> test_function_2()
431 4 print('Not reached.')
432 [EOF]
433 (Pdb) down
434 > <doctest test.test_pdb.test_post_mortem[0]>(3)test_function_2()
435 -> 1/0
436 (Pdb) list
437 1 def test_function_2():
438 2 try:
439 3 >> 1/0
440 4 finally:
441 5 -> print('Exception!')
442 [EOF]
443 (Pdb) continue
444 Correctly reraised.
445 """
446
447
Georg Brandl243ad662009-05-05 09:00:19 +0000448def test_pdb_skip_modules():
449 """This illustrates the simple case of module skipping.
450
451 >>> def skip_module():
452 ... import string
Łukasz Langa2eb6eca2016-09-09 22:21:17 -0700453 ... import pdb; pdb.Pdb(skip=['stri*'], nosigint=True, readrc=False).set_trace()
Georg Brandl243ad662009-05-05 09:00:19 +0000454 ... string.capwords('FOO')
Georg Brandl243ad662009-05-05 09:00:19 +0000455
Georg Brandl9fa2e022009-09-16 16:40:45 +0000456 >>> with PdbTestInput([
457 ... 'step',
458 ... 'continue',
459 ... ]):
Georg Brandl243ad662009-05-05 09:00:19 +0000460 ... skip_module()
Georg Brandl243ad662009-05-05 09:00:19 +0000461 > <doctest test.test_pdb.test_pdb_skip_modules[0]>(4)skip_module()
462 -> string.capwords('FOO')
463 (Pdb) step
464 --Return--
465 > <doctest test.test_pdb.test_pdb_skip_modules[0]>(4)skip_module()->None
466 -> string.capwords('FOO')
467 (Pdb) continue
Georg Brandl9fa2e022009-09-16 16:40:45 +0000468 """
Georg Brandl243ad662009-05-05 09:00:19 +0000469
470
471# Module for testing skipping of module that makes a callback
Brett Cannon9529fbf2013-06-15 17:11:25 -0400472mod = types.ModuleType('module_to_skip')
Georg Brandl243ad662009-05-05 09:00:19 +0000473exec('def foo_pony(callback): x = 1; callback(); return None', mod.__dict__)
474
475
476def test_pdb_skip_modules_with_callback():
477 """This illustrates skipping of modules that call into other code.
478
479 >>> def skip_module():
480 ... def callback():
481 ... return None
Łukasz Langa2eb6eca2016-09-09 22:21:17 -0700482 ... import pdb; pdb.Pdb(skip=['module_to_skip*'], nosigint=True, readrc=False).set_trace()
Georg Brandl243ad662009-05-05 09:00:19 +0000483 ... mod.foo_pony(callback)
Georg Brandl243ad662009-05-05 09:00:19 +0000484
Georg Brandl9fa2e022009-09-16 16:40:45 +0000485 >>> with PdbTestInput([
486 ... 'step',
487 ... 'step',
488 ... 'step',
489 ... 'step',
490 ... 'step',
491 ... 'continue',
492 ... ]):
Georg Brandl243ad662009-05-05 09:00:19 +0000493 ... skip_module()
Georg Brandl9fa2e022009-09-16 16:40:45 +0000494 ... pass # provides something to "step" to
Georg Brandl243ad662009-05-05 09:00:19 +0000495 > <doctest test.test_pdb.test_pdb_skip_modules_with_callback[0]>(5)skip_module()
496 -> mod.foo_pony(callback)
497 (Pdb) step
498 --Call--
499 > <doctest test.test_pdb.test_pdb_skip_modules_with_callback[0]>(2)callback()
500 -> def callback():
501 (Pdb) step
502 > <doctest test.test_pdb.test_pdb_skip_modules_with_callback[0]>(3)callback()
503 -> return None
504 (Pdb) step
505 --Return--
506 > <doctest test.test_pdb.test_pdb_skip_modules_with_callback[0]>(3)callback()->None
507 -> return None
508 (Pdb) step
509 --Return--
510 > <doctest test.test_pdb.test_pdb_skip_modules_with_callback[0]>(5)skip_module()->None
511 -> mod.foo_pony(callback)
512 (Pdb) step
Georg Brandl9fa2e022009-09-16 16:40:45 +0000513 > <doctest test.test_pdb.test_pdb_skip_modules_with_callback[1]>(10)<module>()
514 -> pass # provides something to "step" to
Georg Brandl243ad662009-05-05 09:00:19 +0000515 (Pdb) continue
Georg Brandl9fa2e022009-09-16 16:40:45 +0000516 """
Georg Brandl243ad662009-05-05 09:00:19 +0000517
518
Georg Brandl3f940892010-07-30 10:29:19 +0000519def test_pdb_continue_in_bottomframe():
520 """Test that "continue" and "next" work properly in bottom frame (issue #5294).
521
522 >>> def test_function():
Łukasz Langa2eb6eca2016-09-09 22:21:17 -0700523 ... import pdb, sys; inst = pdb.Pdb(nosigint=True, readrc=False)
Georg Brandl3f940892010-07-30 10:29:19 +0000524 ... inst.set_trace()
525 ... inst.botframe = sys._getframe() # hackery to get the right botframe
526 ... print(1)
527 ... print(2)
528 ... print(3)
529 ... print(4)
530
Georg Brandl7410dd12010-07-30 12:01:20 +0000531 >>> with PdbTestInput([ # doctest: +ELLIPSIS
Georg Brandl3f940892010-07-30 10:29:19 +0000532 ... 'next',
533 ... 'break 7',
534 ... 'continue',
535 ... 'next',
536 ... 'continue',
537 ... 'continue',
538 ... ]):
539 ... test_function()
540 > <doctest test.test_pdb.test_pdb_continue_in_bottomframe[0]>(4)test_function()
541 -> inst.botframe = sys._getframe() # hackery to get the right botframe
542 (Pdb) next
543 > <doctest test.test_pdb.test_pdb_continue_in_bottomframe[0]>(5)test_function()
544 -> print(1)
545 (Pdb) break 7
Georg Brandl7410dd12010-07-30 12:01:20 +0000546 Breakpoint ... at <doctest test.test_pdb.test_pdb_continue_in_bottomframe[0]>:7
Georg Brandl3f940892010-07-30 10:29:19 +0000547 (Pdb) continue
548 1
549 2
550 > <doctest test.test_pdb.test_pdb_continue_in_bottomframe[0]>(7)test_function()
551 -> print(3)
552 (Pdb) next
553 3
554 > <doctest test.test_pdb.test_pdb_continue_in_bottomframe[0]>(8)test_function()
555 -> print(4)
556 (Pdb) continue
557 4
558 """
559
560
Georg Brandl46b9afc2010-07-30 09:14:20 +0000561def pdb_invoke(method, arg):
562 """Run pdb.method(arg)."""
Łukasz Langa2eb6eca2016-09-09 22:21:17 -0700563 getattr(pdb.Pdb(nosigint=True, readrc=False), method)(arg)
Georg Brandl46b9afc2010-07-30 09:14:20 +0000564
565
566def test_pdb_run_with_incorrect_argument():
567 """Testing run and runeval with incorrect first argument.
568
569 >>> pti = PdbTestInput(['continue',])
570 >>> with pti:
571 ... pdb_invoke('run', lambda x: x)
572 Traceback (most recent call last):
573 TypeError: exec() arg 1 must be a string, bytes or code object
574
575 >>> with pti:
576 ... pdb_invoke('runeval', lambda x: x)
577 Traceback (most recent call last):
578 TypeError: eval() arg 1 must be a string, bytes or code object
579 """
580
581
582def test_pdb_run_with_code_object():
583 """Testing run and runeval with code object as a first argument.
584
Georg Brandle1e8df12010-07-31 08:14:16 +0000585 >>> with PdbTestInput(['step','x', 'continue']): # doctest: +ELLIPSIS
Georg Brandl46b9afc2010-07-30 09:14:20 +0000586 ... pdb_invoke('run', compile('x=1', '<string>', 'exec'))
Georg Brandle1e8df12010-07-31 08:14:16 +0000587 > <string>(1)<module>()...
Georg Brandl46b9afc2010-07-30 09:14:20 +0000588 (Pdb) step
589 --Return--
590 > <string>(1)<module>()->None
591 (Pdb) x
592 1
593 (Pdb) continue
594
595 >>> with PdbTestInput(['x', 'continue']):
596 ... x=0
597 ... pdb_invoke('runeval', compile('x+1', '<string>', 'eval'))
598 > <string>(1)<module>()->None
599 (Pdb) x
600 1
601 (Pdb) continue
602 """
603
Guido van Rossum8820c232013-11-21 11:30:06 -0800604def test_next_until_return_at_return_event():
605 """Test that pdb stops after a next/until/return issued at a return debug event.
606
607 >>> def test_function_2():
608 ... x = 1
609 ... x = 2
610
611 >>> def test_function():
Łukasz Langa2eb6eca2016-09-09 22:21:17 -0700612 ... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
Guido van Rossum8820c232013-11-21 11:30:06 -0800613 ... test_function_2()
614 ... test_function_2()
615 ... test_function_2()
616 ... end = 1
617
Antoine Pitrouc04d4682014-08-11 21:40:38 -0400618 >>> from bdb import Breakpoint
619 >>> Breakpoint.next = 1
Guido van Rossum8820c232013-11-21 11:30:06 -0800620 >>> with PdbTestInput(['break test_function_2',
621 ... 'continue',
622 ... 'return',
623 ... 'next',
624 ... 'continue',
625 ... 'return',
626 ... 'until',
627 ... 'continue',
628 ... 'return',
629 ... 'return',
630 ... 'continue']):
631 ... test_function()
632 > <doctest test.test_pdb.test_next_until_return_at_return_event[1]>(3)test_function()
633 -> test_function_2()
634 (Pdb) break test_function_2
635 Breakpoint 1 at <doctest test.test_pdb.test_next_until_return_at_return_event[0]>:1
636 (Pdb) continue
637 > <doctest test.test_pdb.test_next_until_return_at_return_event[0]>(2)test_function_2()
638 -> x = 1
639 (Pdb) return
640 --Return--
641 > <doctest test.test_pdb.test_next_until_return_at_return_event[0]>(3)test_function_2()->None
642 -> x = 2
643 (Pdb) next
644 > <doctest test.test_pdb.test_next_until_return_at_return_event[1]>(4)test_function()
645 -> test_function_2()
646 (Pdb) continue
647 > <doctest test.test_pdb.test_next_until_return_at_return_event[0]>(2)test_function_2()
648 -> x = 1
649 (Pdb) return
650 --Return--
651 > <doctest test.test_pdb.test_next_until_return_at_return_event[0]>(3)test_function_2()->None
652 -> x = 2
653 (Pdb) until
654 > <doctest test.test_pdb.test_next_until_return_at_return_event[1]>(5)test_function()
655 -> test_function_2()
656 (Pdb) continue
657 > <doctest test.test_pdb.test_next_until_return_at_return_event[0]>(2)test_function_2()
658 -> x = 1
659 (Pdb) return
660 --Return--
661 > <doctest test.test_pdb.test_next_until_return_at_return_event[0]>(3)test_function_2()->None
662 -> x = 2
663 (Pdb) return
664 > <doctest test.test_pdb.test_next_until_return_at_return_event[1]>(6)test_function()
665 -> end = 1
666 (Pdb) continue
667 """
668
669def test_pdb_next_command_for_generator():
670 """Testing skip unwindng stack on yield for generators for "next" command
671
672 >>> def test_gen():
673 ... yield 0
674 ... return 1
675 ... yield 2
676
677 >>> def test_function():
Łukasz Langa2eb6eca2016-09-09 22:21:17 -0700678 ... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
Guido van Rossum8820c232013-11-21 11:30:06 -0800679 ... it = test_gen()
680 ... try:
Serhiy Storchakaa16de5d2015-04-01 16:58:19 +0300681 ... if next(it) != 0:
682 ... raise AssertionError
Guido van Rossum8820c232013-11-21 11:30:06 -0800683 ... next(it)
684 ... except StopIteration as ex:
Serhiy Storchakaa16de5d2015-04-01 16:58:19 +0300685 ... if ex.value != 1:
686 ... raise AssertionError
Guido van Rossum8820c232013-11-21 11:30:06 -0800687 ... print("finished")
688
689 >>> with PdbTestInput(['step',
690 ... 'step',
691 ... 'step',
692 ... 'next',
693 ... 'next',
694 ... 'step',
695 ... 'step',
696 ... 'continue']):
697 ... test_function()
698 > <doctest test.test_pdb.test_pdb_next_command_for_generator[1]>(3)test_function()
699 -> it = test_gen()
700 (Pdb) step
701 > <doctest test.test_pdb.test_pdb_next_command_for_generator[1]>(4)test_function()
702 -> try:
703 (Pdb) step
704 > <doctest test.test_pdb.test_pdb_next_command_for_generator[1]>(5)test_function()
Serhiy Storchakaa16de5d2015-04-01 16:58:19 +0300705 -> if next(it) != 0:
Guido van Rossum8820c232013-11-21 11:30:06 -0800706 (Pdb) step
707 --Call--
708 > <doctest test.test_pdb.test_pdb_next_command_for_generator[0]>(1)test_gen()
709 -> def test_gen():
710 (Pdb) next
711 > <doctest test.test_pdb.test_pdb_next_command_for_generator[0]>(2)test_gen()
712 -> yield 0
713 (Pdb) next
714 > <doctest test.test_pdb.test_pdb_next_command_for_generator[0]>(3)test_gen()
715 -> return 1
716 (Pdb) step
717 --Return--
718 > <doctest test.test_pdb.test_pdb_next_command_for_generator[0]>(3)test_gen()->1
719 -> return 1
720 (Pdb) step
721 StopIteration: 1
Serhiy Storchakaa16de5d2015-04-01 16:58:19 +0300722 > <doctest test.test_pdb.test_pdb_next_command_for_generator[1]>(7)test_function()
Guido van Rossum8820c232013-11-21 11:30:06 -0800723 -> next(it)
724 (Pdb) continue
725 finished
726 """
727
728def test_pdb_return_command_for_generator():
729 """Testing no unwindng stack on yield for generators
730 for "return" command
731
732 >>> def test_gen():
733 ... yield 0
734 ... return 1
735 ... yield 2
736
737 >>> def test_function():
Łukasz Langa2eb6eca2016-09-09 22:21:17 -0700738 ... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
Guido van Rossum8820c232013-11-21 11:30:06 -0800739 ... it = test_gen()
740 ... try:
Serhiy Storchakaa16de5d2015-04-01 16:58:19 +0300741 ... if next(it) != 0:
742 ... raise AssertionError
Guido van Rossum8820c232013-11-21 11:30:06 -0800743 ... next(it)
744 ... except StopIteration as ex:
Serhiy Storchakaa16de5d2015-04-01 16:58:19 +0300745 ... if ex.value != 1:
746 ... raise AssertionError
Guido van Rossum8820c232013-11-21 11:30:06 -0800747 ... print("finished")
748
749 >>> with PdbTestInput(['step',
750 ... 'step',
751 ... 'step',
752 ... 'return',
753 ... 'step',
754 ... 'step',
755 ... 'continue']):
756 ... test_function()
757 > <doctest test.test_pdb.test_pdb_return_command_for_generator[1]>(3)test_function()
758 -> it = test_gen()
759 (Pdb) step
760 > <doctest test.test_pdb.test_pdb_return_command_for_generator[1]>(4)test_function()
761 -> try:
762 (Pdb) step
763 > <doctest test.test_pdb.test_pdb_return_command_for_generator[1]>(5)test_function()
Serhiy Storchakaa16de5d2015-04-01 16:58:19 +0300764 -> if next(it) != 0:
Guido van Rossum8820c232013-11-21 11:30:06 -0800765 (Pdb) step
766 --Call--
767 > <doctest test.test_pdb.test_pdb_return_command_for_generator[0]>(1)test_gen()
768 -> def test_gen():
769 (Pdb) return
770 StopIteration: 1
Serhiy Storchakaa16de5d2015-04-01 16:58:19 +0300771 > <doctest test.test_pdb.test_pdb_return_command_for_generator[1]>(7)test_function()
Guido van Rossum8820c232013-11-21 11:30:06 -0800772 -> next(it)
773 (Pdb) step
Serhiy Storchakaa16de5d2015-04-01 16:58:19 +0300774 > <doctest test.test_pdb.test_pdb_return_command_for_generator[1]>(8)test_function()
Guido van Rossum8820c232013-11-21 11:30:06 -0800775 -> except StopIteration as ex:
776 (Pdb) step
Serhiy Storchakaa16de5d2015-04-01 16:58:19 +0300777 > <doctest test.test_pdb.test_pdb_return_command_for_generator[1]>(9)test_function()
778 -> if ex.value != 1:
Guido van Rossum8820c232013-11-21 11:30:06 -0800779 (Pdb) continue
780 finished
781 """
782
783def test_pdb_until_command_for_generator():
784 """Testing no unwindng stack on yield for generators
785 for "until" command if target breakpoing is not reached
786
787 >>> def test_gen():
788 ... yield 0
789 ... yield 1
790 ... yield 2
791
792 >>> def test_function():
Łukasz Langa2eb6eca2016-09-09 22:21:17 -0700793 ... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
Guido van Rossum8820c232013-11-21 11:30:06 -0800794 ... for i in test_gen():
795 ... print(i)
796 ... print("finished")
797
798 >>> with PdbTestInput(['step',
799 ... 'until 4',
800 ... 'step',
801 ... 'step',
802 ... 'continue']):
803 ... test_function()
804 > <doctest test.test_pdb.test_pdb_until_command_for_generator[1]>(3)test_function()
805 -> for i in test_gen():
806 (Pdb) step
807 --Call--
808 > <doctest test.test_pdb.test_pdb_until_command_for_generator[0]>(1)test_gen()
809 -> def test_gen():
810 (Pdb) until 4
811 0
812 1
813 > <doctest test.test_pdb.test_pdb_until_command_for_generator[0]>(4)test_gen()
814 -> yield 2
815 (Pdb) step
816 --Return--
817 > <doctest test.test_pdb.test_pdb_until_command_for_generator[0]>(4)test_gen()->2
818 -> yield 2
819 (Pdb) step
820 > <doctest test.test_pdb.test_pdb_until_command_for_generator[1]>(4)test_function()
821 -> print(i)
822 (Pdb) continue
823 2
824 finished
825 """
826
827def test_pdb_next_command_in_generator_for_loop():
Martin Panter46f50722016-05-26 05:35:26 +0000828 """The next command on returning from a generator controlled by a for loop.
Guido van Rossum8820c232013-11-21 11:30:06 -0800829
830 >>> def test_gen():
831 ... yield 0
832 ... return 1
833
834 >>> def test_function():
Łukasz Langa2eb6eca2016-09-09 22:21:17 -0700835 ... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
Guido van Rossum8820c232013-11-21 11:30:06 -0800836 ... for i in test_gen():
837 ... print('value', i)
838 ... x = 123
839
840 >>> with PdbTestInput(['break test_gen',
841 ... 'continue',
842 ... 'next',
843 ... 'next',
844 ... 'next',
845 ... 'continue']):
846 ... test_function()
847 > <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[1]>(3)test_function()
848 -> for i in test_gen():
849 (Pdb) break test_gen
850 Breakpoint 6 at <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[0]>:1
851 (Pdb) continue
852 > <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[0]>(2)test_gen()
853 -> yield 0
854 (Pdb) next
855 value 0
856 > <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[0]>(3)test_gen()
857 -> return 1
858 (Pdb) next
859 Internal StopIteration: 1
860 > <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[1]>(3)test_function()
861 -> for i in test_gen():
862 (Pdb) next
863 > <doctest test.test_pdb.test_pdb_next_command_in_generator_for_loop[1]>(5)test_function()
864 -> x = 123
865 (Pdb) continue
866 """
867
868def test_pdb_next_command_subiterator():
869 """The next command in a generator with a subiterator.
870
871 >>> def test_subgenerator():
872 ... yield 0
873 ... return 1
874
875 >>> def test_gen():
876 ... x = yield from test_subgenerator()
877 ... return x
878
879 >>> def test_function():
Łukasz Langa2eb6eca2016-09-09 22:21:17 -0700880 ... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
Guido van Rossum8820c232013-11-21 11:30:06 -0800881 ... for i in test_gen():
882 ... print('value', i)
883 ... x = 123
884
885 >>> with PdbTestInput(['step',
886 ... 'step',
887 ... 'next',
888 ... 'next',
889 ... 'next',
890 ... 'continue']):
891 ... test_function()
892 > <doctest test.test_pdb.test_pdb_next_command_subiterator[2]>(3)test_function()
893 -> for i in test_gen():
894 (Pdb) step
895 --Call--
896 > <doctest test.test_pdb.test_pdb_next_command_subiterator[1]>(1)test_gen()
897 -> def test_gen():
898 (Pdb) step
899 > <doctest test.test_pdb.test_pdb_next_command_subiterator[1]>(2)test_gen()
900 -> x = yield from test_subgenerator()
901 (Pdb) next
902 value 0
903 > <doctest test.test_pdb.test_pdb_next_command_subiterator[1]>(3)test_gen()
904 -> return x
905 (Pdb) next
906 Internal StopIteration: 1
907 > <doctest test.test_pdb.test_pdb_next_command_subiterator[2]>(3)test_function()
908 -> for i in test_gen():
909 (Pdb) next
910 > <doctest test.test_pdb.test_pdb_next_command_subiterator[2]>(5)test_function()
911 -> x = 123
912 (Pdb) continue
913 """
914
Georg Brandl46b9afc2010-07-30 09:14:20 +0000915
Georg Brandl6cccb862010-07-30 14:16:43 +0000916class PdbTestCase(unittest.TestCase):
917
Senthil Kumaran42d70812012-05-01 10:07:49 +0800918 def run_pdb(self, script, commands):
919 """Run 'script' lines with pdb and the pdb 'commands'."""
920 filename = 'main.py'
921 with open(filename, 'w') as f:
922 f.write(textwrap.dedent(script))
Georg Brandl4bde9ca2012-05-01 09:21:16 +0200923 self.addCleanup(support.unlink, filename)
Victor Stinner047b7ae2014-10-05 17:37:41 +0200924 self.addCleanup(support.rmtree, '__pycache__')
Senthil Kumaran42d70812012-05-01 10:07:49 +0800925 cmd = [sys.executable, '-m', 'pdb', filename]
926 stdout = stderr = None
927 with subprocess.Popen(cmd, stdout=subprocess.PIPE,
928 stdin=subprocess.PIPE,
929 stderr=subprocess.STDOUT,
930 ) as proc:
931 stdout, stderr = proc.communicate(str.encode(commands))
932 stdout = stdout and bytes.decode(stdout)
933 stderr = stderr and bytes.decode(stderr)
934 return stdout, stderr
935
Georg Brandl6e220552013-10-13 20:51:47 +0200936 def _assert_find_function(self, file_content, func_name, expected):
937 file_content = textwrap.dedent(file_content)
938
939 with open(support.TESTFN, 'w') as f:
940 f.write(file_content)
941
942 expected = None if not expected else (
943 expected[0], support.TESTFN, expected[1])
944 self.assertEqual(
945 expected, pdb.find_function(func_name, support.TESTFN))
946
947 def test_find_function_empty_file(self):
948 self._assert_find_function('', 'foo', None)
949
950 def test_find_function_found(self):
951 self._assert_find_function(
952 """\
953 def foo():
954 pass
955
956 def bar():
957 pass
958
959 def quux():
960 pass
961 """,
962 'bar',
963 ('bar', 4),
964 )
965
Georg Brandl6cccb862010-07-30 14:16:43 +0000966 def test_issue7964(self):
967 # open the file as binary so we can force \r\n newline
968 with open(support.TESTFN, 'wb') as f:
969 f.write(b'print("testing my pdb")\r\n')
970 cmd = [sys.executable, '-m', 'pdb', support.TESTFN]
971 proc = subprocess.Popen(cmd,
972 stdout=subprocess.PIPE,
973 stdin=subprocess.PIPE,
974 stderr=subprocess.STDOUT,
975 )
Brian Curtin994ad6c2010-11-05 15:38:47 +0000976 self.addCleanup(proc.stdout.close)
Georg Brandl6cccb862010-07-30 14:16:43 +0000977 stdout, stderr = proc.communicate(b'quit\n')
978 self.assertNotIn(b'SyntaxError', stdout,
979 "Got a syntax error running test script under PDB")
980
Senthil Kumaran42d70812012-05-01 10:07:49 +0800981 def test_issue13183(self):
982 script = """
983 from bar import bar
984
985 def foo():
986 bar()
987
988 def nope():
989 pass
990
991 def foobar():
992 foo()
993 nope()
994
995 foobar()
996 """
997 commands = """
998 from bar import bar
999 break bar
1000 continue
1001 step
1002 step
1003 quit
1004 """
1005 bar = """
1006 def bar():
Senthil Kumarancb172042012-05-02 08:00:22 +08001007 pass
Senthil Kumaran42d70812012-05-01 10:07:49 +08001008 """
1009 with open('bar.py', 'w') as f:
1010 f.write(textwrap.dedent(bar))
Georg Brandl4bde9ca2012-05-01 09:21:16 +02001011 self.addCleanup(support.unlink, 'bar.py')
Senthil Kumaran42d70812012-05-01 10:07:49 +08001012 stdout, stderr = self.run_pdb(script, commands)
Georg Brandl4bde9ca2012-05-01 09:21:16 +02001013 self.assertTrue(
1014 any('main.py(5)foo()->None' in l for l in stdout.splitlines()),
1015 'Fail to step into the caller after a return')
Senthil Kumaran42d70812012-05-01 10:07:49 +08001016
Andrew Svetlov539ee5d2012-12-04 21:08:28 +02001017 def test_issue13210(self):
1018 # invoking "continue" on a non-main thread triggered an exception
1019 # inside signal.signal
1020
Andrew Svetlov96bc0432012-12-05 15:06:23 +02001021 # raises SkipTest if python was built without threads
1022 support.import_module('threading')
1023
Andrew Svetlov539ee5d2012-12-04 21:08:28 +02001024 with open(support.TESTFN, 'wb') as f:
1025 f.write(textwrap.dedent("""
1026 import threading
1027 import pdb
1028
1029 def start_pdb():
Łukasz Langa2eb6eca2016-09-09 22:21:17 -07001030 pdb.Pdb(readrc=False).set_trace()
Andrew Svetlov539ee5d2012-12-04 21:08:28 +02001031 x = 1
1032 y = 1
1033
1034 t = threading.Thread(target=start_pdb)
1035 t.start()""").encode('ascii'))
1036 cmd = [sys.executable, '-u', support.TESTFN]
1037 proc = subprocess.Popen(cmd,
1038 stdout=subprocess.PIPE,
1039 stdin=subprocess.PIPE,
1040 stderr=subprocess.STDOUT,
1041 )
1042 self.addCleanup(proc.stdout.close)
1043 stdout, stderr = proc.communicate(b'cont\n')
1044 self.assertNotIn('Error', stdout.decode(),
1045 "Got an error running test script under PDB")
1046
Terry Jan Reedyca3f4352015-09-05 19:13:26 -04001047 def test_issue16180(self):
1048 # A syntax error in the debuggee.
1049 script = "def f: pass\n"
1050 commands = ''
1051 expected = "SyntaxError:"
1052 stdout, stderr = self.run_pdb(script, commands)
1053 self.assertIn(expected, stdout,
1054 '\n\nExpected:\n{}\nGot:\n{}\n'
1055 'Fail to handle a syntax error in the debuggee.'
1056 .format(expected, stdout))
1057
1058
Łukasz Langa2eb6eca2016-09-09 22:21:17 -07001059 def test_readrc_kwarg(self):
1060 save_home = os.environ['HOME']
1061 save_dir = os.getcwd()
1062 script = """import pdb; pdb.Pdb(readrc=False).set_trace()
1063
1064print('hello')
1065"""
1066 del os.environ['HOME']
1067 try:
1068 with tempfile.TemporaryDirectory() as dirname:
1069 os.chdir(dirname)
1070 with open('.pdbrc', 'w') as f:
1071 f.write("invalid\n")
1072
1073 with open('main.py', 'w') as f:
1074 f.write(script)
1075
1076 cmd = [sys.executable, 'main.py']
1077 proc = subprocess.Popen(
1078 cmd,
1079 stdout=subprocess.PIPE,
1080 stdin=subprocess.PIPE,
1081 stderr=subprocess.PIPE,
1082 )
1083 self.addCleanup(proc.stdout.close)
1084 self.addCleanup(proc.stderr.close)
1085 stdout, stderr = proc.communicate(b'q\n')
1086 self.assertNotIn("NameError: name 'invalid' is not defined",
1087 stdout.decode())
1088
1089 finally:
1090 os.environ['HOME'] = save_home
1091 os.chdir(save_dir)
1092
Georg Brandl6cccb862010-07-30 14:16:43 +00001093 def tearDown(self):
1094 support.unlink(support.TESTFN)
1095
1096
Andrew Svetlovf0efea02013-03-18 10:09:50 -07001097def load_tests(*args):
Georg Brandl243ad662009-05-05 09:00:19 +00001098 from test import test_pdb
Łukasz Langa2eb6eca2016-09-09 22:21:17 -07001099 suites = [unittest.makeSuite(PdbTestCase)]
Andrew Svetlovf0efea02013-03-18 10:09:50 -07001100 return unittest.TestSuite(suites)
Georg Brandl243ad662009-05-05 09:00:19 +00001101
1102
1103if __name__ == '__main__':
Andrew Svetlovf0efea02013-03-18 10:09:50 -07001104 unittest.main()