Show More
@@ -277,14 +277,14 def test_xmode_skip(): | |||||
277 |
|
277 | |||
278 | block = dedent( |
|
278 | block = dedent( | |
279 | """ |
|
279 | """ | |
280 | def f(): |
|
280 | def f(): | |
281 | __tracebackhide__ = True |
|
281 | __tracebackhide__ = True | |
282 | g() |
|
282 | g() | |
283 |
|
283 | |||
284 | def g(): |
|
284 | def g(): | |
285 | raise ValueError |
|
285 | raise ValueError | |
286 |
|
286 | |||
287 | f() |
|
287 | f() | |
288 | """ |
|
288 | """ | |
289 | ) |
|
289 | ) | |
290 |
|
290 | |||
@@ -295,15 +295,15 f() | |||||
295 |
|
295 | |||
296 | block = dedent( |
|
296 | block = dedent( | |
297 | """ |
|
297 | """ | |
298 | def f(): |
|
298 | def f(): | |
299 | __tracebackhide__ = True |
|
299 | __tracebackhide__ = True | |
300 | g() |
|
300 | g() | |
301 |
|
301 | |||
302 | def g(): |
|
302 | def g(): | |
303 | from IPython.core.debugger import set_trace |
|
303 | from IPython.core.debugger import set_trace | |
304 | set_trace() |
|
304 | set_trace() | |
305 |
|
305 | |||
306 | f() |
|
306 | f() | |
307 | """ |
|
307 | """ | |
308 | ) |
|
308 | ) | |
309 |
|
309 | |||
@@ -321,3 +321,69 f() | |||||
321 | child.expect("ipdb>") |
|
321 | child.expect("ipdb>") | |
322 |
|
322 | |||
323 | child.close() |
|
323 | child.close() | |
|
324 | ||||
|
325 | ||||
|
326 | def test_where_erase_value(): | |||
|
327 | """Test that `where` does nto access f_locals and erase values.""" | |||
|
328 | import pexpect | |||
|
329 | ||||
|
330 | env = os.environ.copy() | |||
|
331 | env["IPY_TEST_SIMPLE_PROMPT"] = "1" | |||
|
332 | ||||
|
333 | child = pexpect.spawn( | |||
|
334 | sys.executable, ["-m", "IPython", "--colors=nocolor"], env=env | |||
|
335 | ) | |||
|
336 | child.timeout = 15 * IPYTHON_TESTING_TIMEOUT_SCALE | |||
|
337 | ||||
|
338 | child.expect("IPython") | |||
|
339 | child.expect("\n") | |||
|
340 | child.expect_exact("In [1]") | |||
|
341 | ||||
|
342 | block = dedent( | |||
|
343 | """ | |||
|
344 | def simple_f(): | |||
|
345 | myvar = 1 | |||
|
346 | print(myvar) | |||
|
347 | 1/0 | |||
|
348 | print(myvar) | |||
|
349 | simple_f() """ | |||
|
350 | ) | |||
|
351 | ||||
|
352 | for line in block.splitlines(): | |||
|
353 | child.sendline(line) | |||
|
354 | child.expect_exact(line) | |||
|
355 | child.expect_exact("ZeroDivisionError") | |||
|
356 | child.expect_exact("In [2]:") | |||
|
357 | ||||
|
358 | child.sendline("%debug") | |||
|
359 | ||||
|
360 | ## | |||
|
361 | child.expect("ipdb>") | |||
|
362 | ||||
|
363 | child.sendline("myvar") | |||
|
364 | child.expect("1") | |||
|
365 | ||||
|
366 | ## | |||
|
367 | child.expect("ipdb>") | |||
|
368 | ||||
|
369 | child.sendline("myvar = 2") | |||
|
370 | ||||
|
371 | ## | |||
|
372 | child.expect_exact("ipdb>") | |||
|
373 | ||||
|
374 | child.sendline("myvar") | |||
|
375 | ||||
|
376 | child.expect_exact("2") | |||
|
377 | ||||
|
378 | ## | |||
|
379 | child.expect("ipdb>") | |||
|
380 | child.sendline("where") | |||
|
381 | ||||
|
382 | ## | |||
|
383 | child.expect("ipdb>") | |||
|
384 | child.sendline("myvar") | |||
|
385 | ||||
|
386 | child.expect_exact("2") | |||
|
387 | child.expect("ipdb>") | |||
|
388 | ||||
|
389 | child.close() |
General Comments 0
You need to be logged in to leave comments.
Login now