MCPcopy Create free account
hub / github.com/ipython/ipython / test_run_tb

Function test_run_tb

IPython/core/tests/test_run.py:540–559  ·  view source on GitHub ↗

Test traceback offset in %run

()

Source from the content-addressed store, hash-verified

538
539
540def 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
562def test_multiprocessing_run():

Callers

nothing calls this directly

Calls 4

capture_outputClass · 0.85
writeMethod · 0.45
magicMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected