test(firecracker): satisfy pyright strict + line length in committed-rootfs tests
Annotate the counting_run subprocess.run wrapper (reportMissingParameterType) and wrap an over-long patch target line. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UoEZHDjv84ChoZbozQERhJ
This commit is contained in:
@@ -213,7 +213,8 @@ class TestFirecrackerFreezer(_FakeHomeMixin, unittest.TestCase):
|
|||||||
freezer = FirecrackerFreezer()
|
freezer = FirecrackerFreezer()
|
||||||
agent = _make_agent(slug, "firecracker")
|
agent = _make_agent(slug, "firecracker")
|
||||||
|
|
||||||
with patch("bot_bottle.backend.firecracker.freezer._commit_rootfs_via_ssh") as mock_commit, \
|
commit_fn = "bot_bottle.backend.firecracker.freezer._commit_rootfs_via_ssh"
|
||||||
|
with patch(commit_fn) as mock_commit, \
|
||||||
patch("bot_bottle.backend.freeze.info"), \
|
patch("bot_bottle.backend.freeze.info"), \
|
||||||
patch("bot_bottle.backend.firecracker.freezer.info"):
|
patch("bot_bottle.backend.firecracker.freezer.info"):
|
||||||
freezer.commit(agent)
|
freezer.commit(agent)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import subprocess
|
|||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from typing import Any
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from bot_bottle.backend.firecracker import firecracker_vm, freezer, netpool, util
|
from bot_bottle.backend.firecracker import firecracker_vm, freezer, netpool, util
|
||||||
@@ -189,7 +190,7 @@ class TestBuildCommittedRootfsDir(unittest.TestCase):
|
|||||||
real_run = subprocess.run
|
real_run = subprocess.run
|
||||||
calls = {"n": 0}
|
calls = {"n": 0}
|
||||||
|
|
||||||
def counting_run(argv, *a, **k):
|
def counting_run(argv: list[str], *a: Any, **k: Any) -> Any:
|
||||||
if argv and argv[0] == "tar":
|
if argv and argv[0] == "tar":
|
||||||
calls["n"] += 1
|
calls["n"] += 1
|
||||||
return real_run(argv, *a, **k)
|
return real_run(argv, *a, **k)
|
||||||
|
|||||||
Reference in New Issue
Block a user