fix(tests): satisfy pyright strict on the overlap-test helper
The TestNetpoolOverlap `_routes` helper had an untyped fake_run + a bare `dict`/`object` return, tripping 9 strict-mode errors (missing type args, missing param annotations, `object` not usable as a context manager). Type it properly: entries: list[dict[str, str]], fake_run params, and a `AbstractContextManager[MagicMock]` return. `pyright` is clean again. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WBMWTEtQdJ4W5UrWuLHCck
This commit is contained in:
@@ -8,11 +8,14 @@ the VM boot-arg assembly.
|
||||
from __future__ import annotations
|
||||
|
||||
import base64
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import unittest
|
||||
from contextlib import AbstractContextManager
|
||||
from pathlib import Path
|
||||
from typing import Any, cast
|
||||
from unittest.mock import patch
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from bot_bottle.backend.firecracker import firecracker_vm, netpool
|
||||
from bot_bottle.backend.firecracker.bottle import FirecrackerBottle
|
||||
@@ -137,11 +140,12 @@ class TestNetpoolOverlap(unittest.TestCase):
|
||||
existing host route (Tailscale CGNAT peer, docker/libvirt bridge,
|
||||
LAN) and ignores our own bbfc TAPs + the default route."""
|
||||
|
||||
def _routes(self, entries: list[dict]) -> object:
|
||||
import json
|
||||
import subprocess
|
||||
|
||||
def fake_run(argv, **kwargs):
|
||||
def _routes(
|
||||
self, entries: list[dict[str, str]]
|
||||
) -> AbstractContextManager[MagicMock]:
|
||||
def fake_run(
|
||||
argv: list[str], **kwargs: object
|
||||
) -> subprocess.CompletedProcess[str]:
|
||||
return subprocess.CompletedProcess(
|
||||
argv, 0, stdout=json.dumps(entries), stderr="",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user