@pytest.mark.parametrize('exc, name, exc_text', [(ValueError('exception'), 'ValueError', 'exception'), (ValueError, 'ValueError', 'none'), (ipc.Error, 'misc.ipc.Error', 'none'), (Error, 'test_error.Error', 'none')])
def test_no_err_windows(caplog, exc, name, exc_text, fake_args):
 fake_args.no_err_windows = True
 try:
  raise exc
 except Exception as e:
  with caplog.at_level(logging.ERROR):
   error.handle_fatal_exc(e, fake_args, 'title', pre_text='pre', post_text='post')
 assert (len(caplog.records) == 1)
 expected = ['Handling fatal {} with --no-err-windows!'.format(name), '', 'title: title', 'pre_text: pre', 'post_text: post', 'exception text: {}'.format(exc_text)]
 assert (caplog.records[0].msg == '\n'.join(expected))

@ pytest . mark . parametrize ( 'exc, name, exc_text' , [ ( ValueError ( 'exception' ) , 'ValueError' , 'exception' ) , ( ValueError , 'ValueError' , 'none' ) , ( ipc . Error , 'misc.ipc.Error' , 'none' ) , ( Error , 'test_error.Error' , 'none' ) ] ) def test_no_err_windows ( caplog , exc , name , exc_text , fake_args ) : fake_args . no_err_windows = True try : raise exc except Exception as e : with caplog . at_level ( logging . ERROR ) : error . handle_fatal_exc ( e , fake_args , 'title' , pre_text = 'pre' , post_text = 'post' ) assert ( len ( caplog . records ) == 1 ) expected = [ 'Handling fatal {} with --no-err-windows!' . format ( name ) , '' , 'title: title' , 'pre_text: pre' , 'post_text: post' , 'exception text: {}' . format ( exc_text ) ] assert ( caplog . records [ 0 ] . msg == '\n' . join ( expected ) )
test handle_fatal_exc with no_err_windows = true .