示例#1
0
def test_run_module_command_called_process_error(fake_process: FakeProcess) -> None:
    """Test run_module_command raise CalledProcessError."""
    cmd = ["test"]
    fake_process.register_subprocess(cmd, returncode=1)  # type: ignore
    with pytest.raises(CalledProcessError):
        run_module_command(cmd, {}, exit_on_error=False)
    assert fake_process.call_count(cmd) == 1  # type: ignore
示例#2
0
def test_run_module_command_exit_on_error_system_exit(
    fake_process: FakeProcess,
) -> None:
    """Test run_module_command raise SystemExit."""
    cmd = ["test"]
    fake_process.register_subprocess(cmd, returncode=1)  # type: ignore
    with pytest.raises(SystemExit):
        run_module_command(cmd, {})
    assert fake_process.call_count(cmd) == 1  # type: ignore
示例#3
0
def test_run_module_command(fake_process: FakeProcess) -> None:
    """Test run_module_command."""
    cmd = ["test"]
    fake_process.register_subprocess(cmd, returncode=0)  # type: ignore
    assert not run_module_command(cmd, {}, exit_on_error=False)
    assert fake_process.call_count(cmd) == 1  # type: ignore