fix: resolve pylint/pyright issues in new test files
lint / lint (push) Successful in 2m7s
test / unit (pull_request) Successful in 57s
test / integration (pull_request) Successful in 17s
test / coverage (pull_request) Successful in 1m4s

- 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:
2026-07-01 19:47:31 +00:00
parent 57290da1e8
commit 71699b3ecd
4 changed files with 26 additions and 29 deletions
+9 -9
View File
@@ -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__":