def mock_input(testfunc):
 def test_method(self):
  testgen = testfunc(self)
  with mock_input_helper(testgen) as mih:
   mih.ip.interact()
  if (mih.exception is not None):
   (etype, value, tb) = mih.exception
   import traceback
   traceback.print_tb(tb, file=sys.stdout)
   del tb
   raise value
 return test_method

def mock_input ( testfunc ) : def test_method ( self ) : testgen = testfunc ( self ) with mock_input_helper ( testgen ) as mih : mih . ip . interact ( ) if ( mih . exception is not None ) : ( etype , value , tb ) = mih . exception import traceback traceback . print_tb ( tb , file = sys . stdout ) del tb raise value return test_method
decorator for tests of the main interact loop .