From f9662c88a51fc88164493b98406cca6065aeae33 Mon Sep 17 00:00:00 2001 From: claude Date: Thu, 9 Jul 2026 16:11:14 +0000 Subject: [PATCH] fix: pyright errors in test file, bump pyright floor to 1.1.411 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove unused `import dataclasses` and stray `die as real_die` import - Replace lambda side_effect callbacks with list side_effect; lambdas with untyped parameters trigger reportUnknownLambdaType in pyright >=1.1.400 — side_effect=[...] is both cleaner and type-safe - Bump pyright floor from >=1.1.300 to >=1.1.411 in requirements-dev.txt so CI installs a version that matches what the lint job runs Co-Authored-By: Claude Sonnet 4.6 --- requirements-dev.txt | 2 +- tests/unit/test_git_gate_host_key.py | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index a34cdd7..8ba2f16 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -3,5 +3,5 @@ # These tools are used for code quality checks in CI/CD. pylint>=3.0.0 -pyright>=1.1.300 +pyright>=1.1.411 coverage>=7.0.0 diff --git a/tests/unit/test_git_gate_host_key.py b/tests/unit/test_git_gate_host_key.py index 394757e..79b4c50 100644 --- a/tests/unit/test_git_gate_host_key.py +++ b/tests/unit/test_git_gate_host_key.py @@ -2,7 +2,6 @@ from __future__ import annotations -import dataclasses import tempfile import unittest from pathlib import Path @@ -404,20 +403,18 @@ class TestPreflightHostKeys(unittest.TestCase): def test_headless_dies_when_key_missing(self) -> None: manifest = _manifest_with_git() - from bot_bottle.log import die as real_die with self.assertRaises(SystemExit): preflight_host_keys(manifest, headless=True, home_md=None) def test_interactive_fetches_and_confirms_key(self) -> None: manifest = _manifest_with_git() - replies = iter(["y", "n"]) # confirm key, don't persist with patch( "bot_bottle.git_gate_host_key.fetch_host_key", return_value="ssh-ed25519 FETCHED", ), patch( "bot_bottle.git_gate_host_key._prompt_tty", - side_effect=lambda msg: next(replies), + side_effect=["y", "n"], # confirm key, don't persist ), patch("sys.stderr"): result = preflight_host_keys(manifest, headless=False, home_md=None) @@ -437,7 +434,6 @@ class TestPreflightHostKeys(unittest.TestCase): def test_interactive_persists_when_requested(self) -> None: manifest = _manifest_with_git() - replies = iter(["y", "y"]) # confirm key, yes persist with tempfile.TemporaryDirectory() as home: bottles_dir = Path(home) / "bottles" @@ -455,7 +451,7 @@ class TestPreflightHostKeys(unittest.TestCase): return_value="ssh-ed25519 FETCHED", ), patch( "bot_bottle.git_gate_host_key._prompt_tty", - side_effect=lambda msg: next(replies), + side_effect=["y", "y"], # confirm key, yes persist ), patch("sys.stderr"): result = preflight_host_keys( manifest, headless=False, home_md=Path(home), @@ -467,7 +463,6 @@ class TestPreflightHostKeys(unittest.TestCase): def test_interactive_skips_persist_when_declined(self) -> None: manifest = _manifest_with_git() - replies = iter(["y", "n"]) # confirm key, no persist with tempfile.TemporaryDirectory() as home: bottles_dir = Path(home) / "bottles" @@ -485,7 +480,7 @@ class TestPreflightHostKeys(unittest.TestCase): return_value="ssh-ed25519 FETCHED", ), patch( "bot_bottle.git_gate_host_key._prompt_tty", - side_effect=lambda msg: next(replies), + side_effect=["y", "n"], # confirm key, no persist ), patch("sys.stderr"): result = preflight_host_keys( manifest, headless=False, home_md=Path(home), @@ -506,7 +501,6 @@ class TestPreflightHostKeys(unittest.TestCase): def test_interactive_warns_when_persist_file_not_found(self) -> None: manifest = _manifest_with_git() - replies = iter(["y", "y"]) # confirm key, yes persist with tempfile.TemporaryDirectory() as home: # bottles/ dir exists but does not contain the repo entry @@ -520,7 +514,7 @@ class TestPreflightHostKeys(unittest.TestCase): return_value="ssh-ed25519 FETCHED", ), patch( "bot_bottle.git_gate_host_key._prompt_tty", - side_effect=lambda msg: next(replies), + side_effect=["y", "y"], # confirm key, yes persist ), patch("sys.stderr", buf): result = preflight_host_keys( manifest, headless=False, home_md=Path(home),