#NEWLINE# def test_logged_query_successful_log_failure( ) : #NEWLINE# #INDENT# okstub = StubCallable ( ) #NEWLINE# failstub = StubCallable ( throw = NotImplementedError ( 'foo' ) ) #NEWLINE# lgr = loggers . CallHomeStatusLogger ( post = failstub ) #NEWLINE# with loggers . logged_query ( logger = lgr , ** THE_USUAL ) : #NEWLINE# #INDENT# okstub ( 'inside' ) #NEWLINE# #UNINDENT# assert ( 1 == len ( okstub . calls ) ) #NEWLINE# assert ( "[(('inside',), {})]" == str ( okstub . calls ) ) #NEWLINE# time . sleep ( 0.2 ) #NEWLINE# assert ( 1 == len ( failstub . calls ) ) #NEWLINE# check_logcall ( failstub . calls [ 0 ] )