def test_hist_flush_with_store_stdout(hist, xonsh_builtins):
 hf = hist.flush()
 assert (hf is None)
 xonsh_builtins.__xonsh_env__['HISTCONTROL'] = set()
 xonsh_builtins.__xonsh_env__['XONSH_STORE_STDOUT'] = True
 hist.append({'inp': 'still alive?', 'rtn': 0, 'out': 'yes'})
 hf = hist.flush()
 assert (hf is not None)
 while hf.is_alive():
  pass
 with LazyJSON(hist.filename) as lj:
  assert (len(lj['cmds']) == 1)
  assert (lj['cmds'][0]['inp'] == 'still alive?')
  assert (lj['cmds'][0]['out'].strip() == 'yes')

def test_hist_flush_with_store_stdout ( hist , xonsh_builtins ) : hf = hist . flush ( ) assert ( hf is None ) xonsh_builtins . __xonsh_env__ [ 'HISTCONTROL' ] = set ( ) xonsh_builtins . __xonsh_env__ [ 'XONSH_STORE_STDOUT' ] = True hist . append ( { 'inp' : 'still alive?' , 'rtn' : 0 , 'out' : 'yes' } ) hf = hist . flush ( ) assert ( hf is not None ) while hf . is_alive ( ) : pass with LazyJSON ( hist . filename ) as lj : assert ( len ( lj [ 'cmds' ] ) == 1 ) assert ( lj [ 'cmds' ] [ 0 ] [ 'inp' ] == 'still alive?' ) assert ( lj [ 'cmds' ] [ 0 ] [ 'out' ] . strip ( ) == 'yes' )
verify explicit flushing of the history works .