Skip to content
This repository was archived by the owner on Jun 23, 2026. It is now read-only.

Commit 6a5157a

Browse files
committed
test: satisfy setup acceptance type checks
1 parent eb5d2b1 commit 6a5157a

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

tests/test_template_setup_acceptance.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@
2626
}
2727

2828

29+
def _timeout_output(value: str | bytes | None) -> str:
30+
if value is None:
31+
return ""
32+
if isinstance(value, bytes):
33+
return value.decode("utf-8", errors="replace")
34+
return value
35+
36+
2937
def _run(command: list[str], cwd: Path, env: dict[str, str]) -> subprocess.CompletedProcess[str]:
3038
try:
3139
return subprocess.run(
@@ -41,13 +49,13 @@ def _run(command: list[str], cwd: Path, env: dict[str, str]) -> subprocess.Compl
4149
except subprocess.TimeoutExpired as exc:
4250
raise AssertionError(
4351
f"command timed out after {COMMAND_TIMEOUT_SECONDS}s: {' '.join(command)}\n"
44-
f"stdout:\n{exc.stdout or ''}\n"
45-
f"stderr:\n{exc.stderr or ''}"
52+
f"stdout:\n{_timeout_output(exc.stdout)}\n"
53+
f"stderr:\n{_timeout_output(exc.stderr)}"
4654
) from exc
4755

4856

4957
def _read_env_file(path: Path) -> dict[str, str]:
50-
values = {}
58+
values: dict[str, str] = {}
5159
if not path.exists():
5260
return values
5361
for line in path.read_text(encoding="utf-8").splitlines():
@@ -137,8 +145,8 @@ def test_generated_setup_workflow_runs_with_default_github_app_token_permissions
137145
except subprocess.TimeoutExpired as exc:
138146
raise AssertionError(
139147
f"setup step timed out after {COMMAND_TIMEOUT_SECONDS}s: {step['name']}\n"
140-
f"stdout:\n{exc.stdout or ''}\n"
141-
f"stderr:\n{exc.stderr or ''}"
148+
f"stdout:\n{_timeout_output(exc.stdout)}\n"
149+
f"stderr:\n{_timeout_output(exc.stderr)}"
142150
) from exc
143151
assert result.returncode == 0, (
144152
f"setup step failed: {step['name']}\n"

0 commit comments

Comments
 (0)