fix(tests): resolve pyright strict errors in forge test helpers
CI runs `pyright .` over the whole repo including tests; the earlier run only checked the source paths. The test helpers used `**over` dict-splat into typed constructors, which pyright strict rejects. - forge_state: build a typed ForgeState base and dataclasses.replace(**over) - provenance: explicit typed keyword params instead of a **over dict - resume: _launch_kwargs returns dict[str, Any] (copy call_args.kwargs) - forge_base: assert PermissionError in __mro__ (avoids always-true issubclass) - client: annotate _resp body param; type: ignore the mock __enter__ lambda pyright . now 0 errors; 47 tests still pass; pylint 9.97/10. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WL77TgFxKbs3cidGMG9dz7
This commit is contained in:
@@ -4,6 +4,7 @@ from __future__ import annotations
|
||||
|
||||
import tempfile
|
||||
import unittest
|
||||
from dataclasses import replace
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
@@ -15,22 +16,21 @@ from bot_bottle.contrib.gitea.forge_state import (
|
||||
)
|
||||
|
||||
|
||||
def _state(**over) -> ForgeState:
|
||||
base = {
|
||||
"owner": "didericis",
|
||||
"repo": "bot-bottle",
|
||||
"issue_number": 17,
|
||||
"slug": "implementer-abc12",
|
||||
"agent_name": "implementer",
|
||||
"bottle_names": ["claude"],
|
||||
"backend_name": "docker",
|
||||
"agent_git_user": "didericis-claude",
|
||||
"pr_number": 42,
|
||||
"status": STATUS_FROZEN,
|
||||
"last_checkin_at": "2026-06-29T12:04:12-04:00",
|
||||
}
|
||||
base.update(over)
|
||||
return ForgeState(**base)
|
||||
def _state(**over: object) -> ForgeState:
|
||||
base = ForgeState(
|
||||
owner="didericis",
|
||||
repo="bot-bottle",
|
||||
issue_number=17,
|
||||
slug="implementer-abc12",
|
||||
agent_name="implementer",
|
||||
bottle_names=["claude"],
|
||||
backend_name="docker",
|
||||
agent_git_user="didericis-claude",
|
||||
pr_number=42,
|
||||
status=STATUS_FROZEN,
|
||||
last_checkin_at="2026-06-29T12:04:12-04:00",
|
||||
)
|
||||
return replace(base, **over)
|
||||
|
||||
|
||||
class ForgeStateTest(unittest.TestCase):
|
||||
|
||||
Reference in New Issue
Block a user