refactor tests
Publish container image / Build and push (push) Successful in 32s

This commit is contained in:
2026-07-26 23:49:40 +02:00
parent 5ef10d28fe
commit ce9f1e3d20
32 changed files with 1546 additions and 1923 deletions
+27 -39
View File
@@ -36,40 +36,26 @@ def test_normalizes_service_urls(field: str) -> None:
@pytest.mark.parametrize(
("field", "boundaries"),
("field", "accepted", "rejected"),
[
("plan_review_rounds", (1, 20)),
("implement_review_rounds", (1, 20)),
("turn_timeout_seconds", (60,)),
("install_script_timeout_seconds", (1,)),
("worker_poll_seconds", (0.1,)),
("max_concurrent_jobs", (1, 32)),
("plan_review_rounds", (1, 20), (0, 21)),
("implement_review_rounds", (1, 20), (0, 21)),
("turn_timeout_seconds", (60,), (59,)),
("install_script_timeout_seconds", (1,), (0,)),
("worker_poll_seconds", (0.1,), (0.09,)),
("max_concurrent_jobs", (1, 32), (0, 33)),
],
)
def test_accepts_documented_numeric_boundaries(
field: str, boundaries: tuple[int | float, ...]
def test_enforces_documented_numeric_boundaries(
field: str,
accepted: tuple[int | float, ...],
rejected: tuple[int | float, ...],
) -> None:
for boundary in boundaries:
assert getattr(settings(**{field: boundary}), field) == boundary
@pytest.mark.parametrize(
("field", "value"),
[
("plan_review_rounds", 0),
("plan_review_rounds", 21),
("implement_review_rounds", 0),
("implement_review_rounds", 21),
("turn_timeout_seconds", 59),
("install_script_timeout_seconds", 0),
("worker_poll_seconds", 0.09),
("max_concurrent_jobs", 0),
("max_concurrent_jobs", 33),
],
)
def test_rejects_values_outside_numeric_boundaries(field: str, value: int | float) -> None:
with pytest.raises(ValidationError):
settings(**{field: value})
for value in accepted:
assert getattr(settings(**{field: value}), field) == value
for value in rejected:
with pytest.raises(ValidationError):
settings(**{field: value})
def test_reads_and_strips_secret_files(tmp_path: Path) -> None:
@@ -119,21 +105,23 @@ def test_derived_state_paths_follow_data_directory(tmp_path: Path) -> None:
assert value.workspaces_dir == data_dir / "workspaces"
def test_parses_comma_delimited_install_scripts() -> None:
value = settings(install_scripts=" python, dotnet, company-tools, ")
assert value.install_scripts == ["python", "dotnet", "company-tools"]
@pytest.mark.parametrize("value", ["../script", "tools/setup", "python,python"])
def test_rejects_unsafe_or_duplicate_install_scripts(value: str) -> None:
with pytest.raises(ValidationError):
settings(install_scripts=value)
@pytest.mark.parametrize("value", ["", None, []])
def test_empty_install_scripts_disable_setup(value: object) -> None:
assert settings(install_scripts=value).install_scripts == []
@pytest.mark.parametrize(
("value", "expected"),
[
(" python, dotnet, company-tools, ", ["python", "dotnet", "company-tools"]),
("", []),
(None, []),
([], []),
],
)
def test_normalizes_install_scripts(value: object, expected: list[str]) -> None:
assert settings(install_scripts=value).install_scripts == expected
def test_agent_defaults_select_expected_capacity_and_research_models() -> None: