#NEWLINE# def test_stops_worker_on_run_exception( self ) : #NEWLINE# #INDENT# worker = MagicMock ( ) #NEWLINE# self . worker_scheduler_factory . create_worker = Mock ( return_value = worker ) #NEWLINE# worker . add = Mock ( side_effect = [ True , True ] ) #NEWLINE# worker . run = Mock ( side_effect = AttributeError ) #NEWLINE# self . assertRaises ( AttributeError , self . _run_interface ) #NEWLINE# self . assertTrue ( worker . __exit__ . called )