def test_run_exceptions_raise(event_loop): client = BasePeonyClient("", "", loop=event_loop) for exc in (Exception, RuntimeError, peony.exceptions.PeonyException): with patch.object(client, 'run_tasks', side_effect=exc): with pytest.raises(exc): client.run()
def test_run_keyboard_interrupt(event_loop): client = BasePeonyClient("", "", loop=event_loop) with patch.object(client, 'run_tasks', side_effect=KeyboardInterrupt): client.run()