@dec.knownfailureif((sys.platform == 'win32'), "writes to io.stdout aren't captured on Windows")
def test_script_tb():
 with TemporaryDirectory() as td:
  path = pjoin(td, 'foo.py')
  with open(path, 'w') as f:
   f.write('\n'.join(['def foo():', '    return bar()', 'def bar():', "    raise RuntimeError('hello!')", 'foo()']))
  (out, err) = tt.ipexec(path)
  nt.assert_not_in('execfile', out)
  nt.assert_in('RuntimeError', out)
  nt.assert_equal(out.count('---->'), 3)

@ dec . knownfailureif ( ( sys . platform == 'win32' ) , "writes to io.stdout aren't captured on Windows" ) def test_script_tb ( ) : with TemporaryDirectory ( ) as td : path = pjoin ( td , 'foo.py' ) with open ( path , 'w' ) as f : f . write ( '\n' . join ( [ 'def foo():' , '    return bar()' , 'def bar():' , "    raise RuntimeError('hello!')" , 'foo()' ] ) ) ( out , err ) = tt . ipexec ( path ) nt . assert_not_in ( 'execfile' , out ) nt . assert_in ( 'RuntimeError' , out ) nt . assert_equal ( out . count ( '---->' ) , 3 )
test traceback offset in ipython script .