fix: resolve pylint/pyright issues in new test files
- test_contrib_gitea_client: remove unused Any import, fix _mock_response to use return_value instead of lambda (unknown lambda type), narrow HTTPError hdrs type, add type annotations to fake_urlopen helpers, suppress protected-access for _request tests - test_bootstrap: annotate **kw as **kw: object, use dict literal, unpack server_address via index to avoid tuple type mismatch - test_main: remove unused MagicMock import - test_watchdog: guard store.get() result before accessing .status Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -35,12 +35,12 @@ def _config(tmp: str) -> Config:
|
||||
)
|
||||
|
||||
|
||||
def _record(**kw) -> RunRecord:
|
||||
defaults: dict[str, object] = dict(
|
||||
owner="o", repo="r", issue_number=1, slug="s1", agent_name="a",
|
||||
bottle_names=["claude"], backend_name="docker", agent_git_user="bot",
|
||||
pr_number=5, status="running", last_checkin_at="2026-01-01T00:00:00+00:00",
|
||||
)
|
||||
def _record(**kw: object) -> RunRecord:
|
||||
defaults: dict[str, object] = {
|
||||
"owner": "o", "repo": "r", "issue_number": 1, "slug": "s1", "agent_name": "a",
|
||||
"bottle_names": ["claude"], "backend_name": "docker", "agent_git_user": "bot",
|
||||
"pr_number": 5, "status": "running", "last_checkin_at": "2026-01-01T00:00:00+00:00",
|
||||
}
|
||||
defaults.update(kw)
|
||||
return RunRecord(**defaults) # type: ignore[arg-type]
|
||||
|
||||
@@ -169,10 +169,10 @@ class BuildTest(unittest.TestCase):
|
||||
config = _config(tmp)
|
||||
with patch.dict(os.environ, {"GITEA_TOKEN": "tok"}):
|
||||
server, _, _ = build(config)
|
||||
host, port = server.server_address
|
||||
addr = server.server_address
|
||||
server.server_close()
|
||||
self.assertEqual("127.0.0.1", host)
|
||||
self.assertGreater(port, 0)
|
||||
self.assertEqual("127.0.0.1", addr[0])
|
||||
self.assertGreater(addr[1], 0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -4,7 +4,7 @@ from __future__ import annotations
|
||||
|
||||
import io
|
||||
import unittest
|
||||
from unittest.mock import MagicMock, patch
|
||||
from unittest.mock import patch
|
||||
|
||||
from bot_bottle.orchestrator.__main__ import main
|
||||
from bot_bottle.orchestrator.config import Config
|
||||
|
||||
@@ -71,7 +71,9 @@ class WatchdogSweepTest(unittest.TestCase):
|
||||
self.wd.start()
|
||||
time.sleep(0.05) # enough for several iterations at 0.01s tick
|
||||
self.wd.stop()
|
||||
self.assertEqual(STATUS_FROZEN, self.store.get("o", "r", 5).status)
|
||||
rec = self.store.get("o", "r", 5)
|
||||
assert rec is not None
|
||||
self.assertEqual(STATUS_FROZEN, rec.status)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user