From 0adbf2597735f4813cb64d36148ff6dc6dcf1e02 Mon Sep 17 00:00:00 2001 From: didericis Date: Sun, 19 Jul 2026 01:31:06 -0400 Subject: [PATCH] test(firecracker): satisfy pyright on the new infra-VM tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two lint fixes, both test-only (no effect on the infra artifact version): - annotate the TestAdoptable / TestKillInfraFirecrackers helper params (reportMissingParameterType). - test_docker_test_helpers: read __unittest_skip__ via getattr on the dynamically-built Case type, matching the sibling assertion — pyright can't see the attribute the skip decorator adds (reportAttributeAccessIssue). Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01A9qa3xoavjQScufDfZaXKR --- tests/unit/test_docker_test_helpers.py | 2 +- tests/unit/test_firecracker_infra_vm.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/test_docker_test_helpers.py b/tests/unit/test_docker_test_helpers.py index c7f9a33..a6c1e37 100644 --- a/tests/unit/test_docker_test_helpers.py +++ b/tests/unit/test_docker_test_helpers.py @@ -28,7 +28,7 @@ class TestSkipUnlessDockerOrFirecracker(unittest.TestCase): ): decorated = skip_unless_docker_or_firecracker()(type("Case", (), {})) - self.assertTrue(decorated.__unittest_skip__) + self.assertTrue(getattr(decorated, "__unittest_skip__", False)) if __name__ == "__main__": diff --git a/tests/unit/test_firecracker_infra_vm.py b/tests/unit/test_firecracker_infra_vm.py index 0521ecd..74c3b93 100644 --- a/tests/unit/test_firecracker_infra_vm.py +++ b/tests/unit/test_firecracker_infra_vm.py @@ -219,7 +219,7 @@ class TestKillPidfile(unittest.TestCase): class TestAdoptable(unittest.TestCase): - def _dir(self, td, *, key=True, version=None): + def _dir(self, td: str, *, key: bool = True, version: str | None = None) -> Path: d = Path(td) if key: (d / "id_ed25519").write_text("k") @@ -259,7 +259,7 @@ class TestAdoptable(unittest.TestCase): class TestKillInfraFirecrackers(unittest.TestCase): - def _fake_proc(self, root, pid, comm, cmdline): + def _fake_proc(self, root: Path, pid: int, comm: str, cmdline: list[str]) -> None: p = root / str(pid) p.mkdir() (p / "comm").write_text(comm + "\n")