20 lines
624 B
Python
20 lines
624 B
Python
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from cf_temp_email_deploy.errors import CommandExecutionError
|
|
from cf_temp_email_deploy.subprocess_runner import CommandRunner, CommandSpec
|
|
|
|
|
|
def test_command_runner_captures_stdout() -> None:
|
|
runner = CommandRunner()
|
|
result = runner.run_checked(CommandSpec(args=("python3", "-c", "print('ok')")))
|
|
assert result.stdout.strip() == "ok"
|
|
|
|
|
|
def test_command_runner_raises_for_non_zero_exit() -> None:
|
|
runner = CommandRunner()
|
|
with pytest.raises(CommandExecutionError):
|
|
runner.run_checked(CommandSpec(args=("python3", "-c", "raise SystemExit(3)")))
|
|
|