mirror of
https://github.com/kuhyx/steam-backlog-enforcer.git
synced 2026-11-11 19:33:49 +01:00
The enforcer now imports the Steam/launcher/counted-process scan from leisure_watch.procscan (v0.1.0, shared with the leisure watcher) and drops its own copies (_playtime_procs, _counted_procs, _total_block_launchers and enforcer's two scanners). Every counted-process read passes config.CONFIG_FILE explicitly, as before. Each tick also bills a shadow leisure budget beside the enforced one, from the same incoming stamp and delta clamp, before accumulate: paused (held gatelock grab or i3lock) -> shadow_paused_seconds; else a qualifying game, a "leisure" now.json, or an untrusted/missing now.json (fail closed) bills shadow_seconds once, split over shadow_per_source. shadow_budget_seconds is earned_time.resolve(leisure=True) from the same answers, held as a same-day high-water mark. Not billed under a total block. Shadow verdict changes go to budget.jsonl as shadow_change (the live game view skips them); /api/budget and MCP get_gaming_time carry a "shadow" block. Enforced fields, cutoff, warnings and existing log records are unchanged. Also fixes two tests that assumed earned_time < 0.14 internals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dsh4Znwh2KnC7q6vbGpX1N
23 lines
644 B
Python
23 lines
644 B
Python
"""Tests for _playtime_notify._humanise (kept from test_playtime_procs)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from steam_backlog_enforcer._playtime_notify import _humanise
|
|
|
|
|
|
class TestHumanise:
|
|
def test_seconds(self) -> None:
|
|
assert _humanise(30) == "30 seconds"
|
|
|
|
def test_exact_minute_boundary(self) -> None:
|
|
assert _humanise(60) == "1 minutes"
|
|
|
|
def test_minutes(self) -> None:
|
|
assert _humanise(300) == "5 minutes"
|
|
|
|
def test_one_hour_is_special_cased(self) -> None:
|
|
assert _humanise(3600) == "1 hour"
|
|
|
|
def test_thirty_minutes(self) -> None:
|
|
assert _humanise(1800) == "30 minutes"
|