Пример #1
0
async def test_exit_if_job_failed_does_nothing_if_job_is_not_finished(mocker):
    ui = TUI()
    mocker.patch.object(ui, '_exit')
    ui._exit_if_job_failed(Mock(is_finished=False, exit_code=0, exceptions=()))
    assert ui._exit.call_args_list == []
    ui._exit_if_job_failed(
        Mock(is_finished=False, exit_code=123, exceptions=()))
    assert ui._exit.call_args_list == []
Пример #2
0
async def test_exit_if_job_failed_calls_exit_if_exit_code_is_nonzero(mocker):
    ui = TUI()
    mocker.patch.object(ui, '_exit')
    mocker.patch.object(ui, '_finish_jobs')
    ui._exit_if_job_failed(Mock(is_finished=True, exit_code=1, exceptions=()))
    assert ui._exit.call_args_list == [call()]