#NEWLINE# def test_timer_duration( self ) : #NEWLINE# #INDENT# start_time = time . time ( ) #NEWLINE# end_time = time . time ( ) #NEWLINE# with mock . patch ( 'rally.common.utils.time' ) as mock_time : #NEWLINE# #INDENT# mock_time . time = mock . MagicMock ( return_value = start_time ) #NEWLINE# with utils . Timer ( ) as timer : #NEWLINE# #INDENT# mock_time . time = mock . MagicMock ( return_value = end_time ) #NEWLINE# #UNINDENT# #UNINDENT# self . assertIsNone ( timer . error ) #NEWLINE# self . assertEqual ( ( end_time - start_time ) , timer . duration ( ) )