diff --git a/pyproject.toml b/pyproject.toml index 743c836..3996ddf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -176,11 +176,9 @@ disable = [ [tool.pylint.design] min-public-methods = 0 max-module-lines = 250 -# 15 = the widest persisted record (config.Config). Config, State and -# PlaytimeState are flat JSON files the live daemon reads and writes; WebGame -# is the UI's row shape. Splitting them under 10 would change the on-disk shape -# or hide it behind property forwarders written only for this check. -max-attributes = 15 +# 10, the repo's original value: wider persisted records group their +# fields into nested dataclasses and keep a flat on-disk JSON shape. +max-attributes = 10 [tool.pylint.typecheck] generated-members = [ diff --git a/steam_backlog_enforcer/tests/_research_fixtures.py b/steam_backlog_enforcer/tests/_research_fixtures.py index b9c8704..c14c12d 100644 --- a/steam_backlog_enforcer/tests/_research_fixtures.py +++ b/steam_backlog_enforcer/tests/_research_fixtures.py @@ -22,6 +22,16 @@ BLOCK = "steam_backlog_enforcer._total_block" NOW_PATCH = "steam_backlog_enforcer._research_window.now" +@dataclass +class SteamMocks: + """The pass's Steam package effects.""" + + installed: MagicMock + kill: MagicMock + uninstall: MagicMock + purge: MagicMock + + @dataclass class Mocks: """The collaborators of one pass, all stand-ins.""" @@ -30,14 +40,11 @@ class Mocks: reconcile: MagicMock launchers: MagicMock counted: MagicMock - steam_installed: MagicMock enforce: MagicMock guard: MagicMock notify: MagicMock restore_store: MagicMock - steam_kill: MagicMock - steam_uninstall: MagicMock - steam_purge: MagicMock + steam: SteamMocks @pytest.fixture @@ -63,14 +70,11 @@ def tm(total_block_paths: Paths) -> Iterator[Mocks]: reconcile, launchers, counted, - installed, enforce, guard, notify, restore_store, - steam_kill, - steam_uninstall, - steam_purge, + SteamMocks(installed, steam_kill, steam_uninstall, steam_purge), ) diff --git a/steam_backlog_enforcer/tests/test_research_tick.py b/steam_backlog_enforcer/tests/test_research_tick.py index 501a20e..f227c25 100644 --- a/steam_backlog_enforcer/tests/test_research_tick.py +++ b/steam_backlog_enforcer/tests/test_research_tick.py @@ -72,9 +72,9 @@ class TestOpenWindow: """Test that the destructive half of the block stays off.""" window.write_record(make_record()) run_pass() - tm.steam_kill.assert_not_called() - tm.steam_uninstall.assert_not_called() - tm.steam_purge.assert_not_called() + tm.steam.kill.assert_not_called() + tm.steam.uninstall.assert_not_called() + tm.steam.purge.assert_not_called() def test_other_launchers_and_counted_games_are_still_killed( self, tm: Mocks @@ -105,7 +105,7 @@ class TestOpenWindow: self, tm: Mocks ) -> None: """Test that the install gap does not scan an absent library.""" - tm.steam_installed.return_value = False + tm.steam.installed.return_value = False window.write_record(make_record()) run_pass() tm.enforce.assert_not_called()