def test_terrain_import_exception():
 string = 'Lettuce has tried to load the conventional environment module "terrain"\nbut it has errors, check its contents and try to run lettuce again.\n\nOriginal traceback below:\n\n'
 mox = Mox()
 mox.StubOutWithMock(lettuce.fs, 'FileSystem')
 mox.StubOutWithMock(lettuce.exceptions, 'traceback')
 mox.StubOutWithMock(lettuce.sys, 'stderr')
 exc = Exception('foo bar')
 lettuce.fs.FileSystem._import('terrain').AndRaise(exc)
 lettuce.exceptions.traceback.format_exc(exc).AndReturn('I AM THE TRACEBACK FOR IMPORT ERROR')
 lettuce.sys.stderr.write(string)
 lettuce.sys.stderr.write('I AM THE TRACEBACK FOR IMPORT ERROR')
 mox.ReplayAll()
 try:
  reload(lettuce)
 except LettuceRunnerError:
  mox.VerifyAll()
 finally:
  mox.UnsetStubs()

def test_terrain_import_exception ( ) : string = 'Lettuce has tried to load the conventional environment module "terrain"\nbut it has errors, check its contents and try to run lettuce again.\n\nOriginal traceback below:\n\n' mox = Mox ( ) mox . StubOutWithMock ( lettuce . fs , 'FileSystem' ) mox . StubOutWithMock ( lettuce . exceptions , 'traceback' ) mox . StubOutWithMock ( lettuce . sys , 'stderr' ) exc = Exception ( 'foo bar' ) lettuce . fs . FileSystem . _import ( 'terrain' ) . AndRaise ( exc ) lettuce . exceptions . traceback . format_exc ( exc ) . AndReturn ( 'I AM THE TRACEBACK FOR IMPORT ERROR' ) lettuce . sys . stderr . write ( string ) lettuce . sys . stderr . write ( 'I AM THE TRACEBACK FOR IMPORT ERROR' ) mox . ReplayAll ( ) try : reload ( lettuce ) except LettuceRunnerError : mox . VerifyAll ( ) finally : mox . UnsetStubs ( )
lettuce error tries to import .