def test_histmanager_disabled():
 cfg = Config()
 cfg.HistoryAccessor.enabled = False
 ip = get_ipython()
 with TemporaryDirectory() as tmpdir:
  hist_manager_ori = ip.history_manager
  hist_file = os.path.join(tmpdir, 'history.sqlite')
  cfg.HistoryManager.hist_file = hist_file
  try:
   ip.history_manager = HistoryManager(shell=ip, config=cfg)
   hist = [u'a=1', u'def f():\n    test = 1\n    return test', u"b='\u20ac\xc6\xbe\xf7\xdf'"]
   for (i, h) in enumerate(hist, start=1):
    ip.history_manager.store_inputs(i, h)
   nt.assert_equal(ip.history_manager.input_hist_raw, ([''] + hist))
   ip.history_manager.reset()
   ip.history_manager.end_session()
  finally:
   ip.history_manager = hist_manager_ori
 nt.assert_false(os.path.exists(hist_file))

def test_histmanager_disabled ( ) : cfg = Config ( ) cfg . HistoryAccessor . enabled = False ip = get_ipython ( ) with TemporaryDirectory ( ) as tmpdir : hist_manager_ori = ip . history_manager hist_file = os . path . join ( tmpdir , 'history.sqlite' ) cfg . HistoryManager . hist_file = hist_file try : ip . history_manager = HistoryManager ( shell = ip , config = cfg ) hist = [ u'a=1' , u'def f():\n    test = 1\n    return test' , u"b='\u20ac\xc6\xbe\xf7\xdf'" ] for ( i , h ) in enumerate ( hist , start = 1 ) : ip . history_manager . store_inputs ( i , h ) nt . assert_equal ( ip . history_manager . input_hist_raw , ( [ '' ] + hist ) ) ip . history_manager . reset ( ) ip . history_manager . end_session ( ) finally : ip . history_manager = hist_manager_ori nt . assert_false ( os . path . exists ( hist_file ) )
ensure that disabling the history manager doesnt create a database .