style(s41): ruff format preflight test files

This commit is contained in:
Kjell Tore Guttormsen 2026-07-15 11:25:26 +02:00
commit b513e64577
2 changed files with 5 additions and 7 deletions

View file

@ -72,9 +72,7 @@ def test_wrong_host_surface_refused(
assert "openai.azure.com" in capsys.readouterr().err assert "openai.azure.com" in capsys.readouterr().err
def test_bare_host_endpoint_accepted( def test_bare_host_endpoint_accepted(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
) -> None:
# Research §3: official samples use the bare-host form (no /api/projects/) — must be accepted. # Research §3: official samples use the bare-host form (no /api/projects/) — must be accepted.
monkeypatch.setenv("PORTFOLIO_MODEL_MAP", str(_write_map(tmp_path, _VALID_MAP))) monkeypatch.setenv("PORTFOLIO_MODEL_MAP", str(_write_map(tmp_path, _VALID_MAP)))
monkeypatch.setenv("PORTFOLIO_FOUNDRY_PROJECT_ENDPOINT", "https://x.services.ai.azure.com") monkeypatch.setenv("PORTFOLIO_FOUNDRY_PROJECT_ENDPOINT", "https://x.services.ai.azure.com")

View file

@ -61,7 +61,9 @@ def test_sc6_no_network_or_autologin_in_preflight() -> None:
called.append(fn.attr) called.append(fn.attr)
bad_imports = sorted(set(imported) & _FORBIDDEN_IMPORTS) bad_imports = sorted(set(imported) & _FORBIDDEN_IMPORTS)
bad_calls = sorted(set(called) & _FORBIDDEN_CALLS) bad_calls = sorted(set(called) & _FORBIDDEN_CALLS)
assert bad_imports == [], f"preflight must have no network/subprocess import, found: {bad_imports}" assert bad_imports == [], (
f"preflight must have no network/subprocess import, found: {bad_imports}"
)
assert bad_calls == [], f"preflight must not acquire a credential/token, found: {bad_calls}" assert bad_calls == [], f"preflight must not acquire a credential/token, found: {bad_calls}"
@ -77,9 +79,7 @@ def test_sc1_refusal_names_the_exact_placeholder(monkeypatch: pytest.MonkeyPatch
assert "REPLACE-WITH-FOUNDRY-DEPLOYMENT" in result.reason assert "REPLACE-WITH-FOUNDRY-DEPLOYMENT" in result.reason
def test_sc4_resolve_model_guard_has_teeth( def test_sc4_resolve_model_guard_has_teeth(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
) -> None:
"""SC4 teeth: resolve_model raises on a REPLACE-WITH-* azure deployment. Detach point: remove the """SC4 teeth: resolve_model raises on a REPLACE-WITH-* azure deployment. Detach point: remove the
_PLACEHOLDER_PREFIX guard in resolve_model it returns the placeholder RED. Control: a valid _PLACEHOLDER_PREFIX guard in resolve_model it returns the placeholder RED. Control: a valid
override returns the real id, so the raise fires only on the placeholder, not always.""" override returns the real id, so the raise fires only on the placeholder, not always."""