示例#1
0
def test_main_other_output_failure(capsys):
    with mock.patch('check_project.cli.start_process') as mock_start_process:
        mock_start_process.return_value = (3, ["jb", "kg", "lee"])
        with pytest.raises(SystemExit) as captured_system_exit:
            main()
    assert captured_system_exit.value.code == 3

    out, err = capsys.readouterr()
    assert out == "jb\nkg\nlee\n"
    assert not err
示例#2
0
def test_main(capsys):
    with mock.patch('check_project.cli.start_process') as mock_start_process:
        mock_start_process.return_value = (0, ["line 1", "line 2"])
        with pytest.raises(SystemExit) as captured_system_exit:
            main()
    assert captured_system_exit.value.code == 0

    out, err = capsys.readouterr()
    assert out == "line 1\nline 2\n"
    assert not err