async def test_deleter_run_exception(config, mocker): """Test an error doesn't kill the Deleter.""" logger_mock = mocker.MagicMock() p = Deleter(config, logger_mock) p.last_work_end_timestamp = None p._do_work = AsyncMock() p._do_work.side_effect = [Exception("bad thing happen!")] await p.run() p._do_work.assert_called() assert p.last_work_end_timestamp
async def test_deleter_run_exception(config, mocker): """Test an error doesn't kill the Deleter.""" logger_mock = mocker.MagicMock() dw_mock = mocker.patch( "lta.deleter.Deleter._do_work") # , new_callable=AsyncMock) dw_mock.side_effect = [Exception("bad thing happen!")] p = Deleter(config, logger_mock) p.last_work_end_timestamp = None await p.run() assert p.last_work_end_timestamp dw_mock.assert_called()