Test traceback offset in %run
()
| 538 | |
| 539 | |
| 540 | def test_run_tb(): |
| 541 | """Test traceback offset in %run""" |
| 542 | with TemporaryDirectory() as td: |
| 543 | path = pjoin(td, 'foo.py') |
| 544 | with open(path, 'w') as f: |
| 545 | f.write('\n'.join([ |
| 546 | "def foo():", |
| 547 | " return bar()", |
| 548 | "def bar():", |
| 549 | " raise RuntimeError('hello!')", |
| 550 | "foo()", |
| 551 | ])) |
| 552 | with capture_output() as io: |
| 553 | _ip.magic('run {}'.format(path)) |
| 554 | out = io.stdout |
| 555 | nt.assert_not_in("execfile", out) |
| 556 | nt.assert_in("RuntimeError", out) |
| 557 | nt.assert_equal(out.count("---->"), 3) |
| 558 | del ip.user_ns['bar'] |
| 559 | del ip.user_ns['foo'] |
| 560 | |
| 561 | |
| 562 | def test_multiprocessing_run(): |
nothing calls this directly
no test coverage detected