steam-backlog-enforcer/steam_installer/tests/_recognize_helpers.py
Krzysztof kuhy Rudnicki a76e726e36 Merge steam-game-installer into the repo
The installer ships as the steam_installer package beside
steam_backlog_enforcer, with its tests, docs and Proton lock. The
enforcer's fast install now starts the installer from this checkout.

Both appinfo.vdf readers share one key-value decoder
(steam_installer.appinfo_kv), and the duplicated test fixtures and
helpers are folded into conftest and _cli_helpers so the whole-tree
duplicate-code check is clean. check_requirements_sync treats sibling
packages as first-party.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWZCxnNWLtpVwFLVk9w
2026-11-22 20:25:39 +01:00

37 lines
1.1 KiB
Python

"""Fixtures-as-functions shared by the recognize/manifest test files."""
from __future__ import annotations
from typing import TYPE_CHECKING
from steam_installer import vdf
if TYPE_CHECKING:
from pathlib import Path
def _write_partial_manifest(steamapps: Path, appid: int) -> None:
steamapps.mkdir(parents=True, exist_ok=True)
data = {
"appid": str(appid),
"StateFlags": "1026",
"buildid": "23914554",
"SharedDepots": {"228989": "228980"},
}
(steamapps / f"appmanifest_{appid}.acf").write_text(vdf.dumps("AppState", data))
def _fake_proc(tmp_path: Path, entries: dict[str, str | None]) -> Path:
"""Build a /proc-shaped tree: {pid: exe_target_path_or_None}."""
proc = tmp_path / "proc"
proc.mkdir()
for name, target in entries.items():
entry = proc / name
entry.mkdir()
if target is not None:
real = tmp_path / "bin" / target
real.parent.mkdir(parents=True, exist_ok=True)
real.write_text("")
(entry / "exe").symlink_to(real)
return proc