Files
wehub-resource-sync 0418dc5cf9
CI / Python tests (3.10) (push) Has been cancelled
CI / Python tests (3.11) (push) Has been cancelled
CI / Python quality (push) Has been cancelled
CI / Frontend typecheck (push) Has been cancelled
Autopilot Pages / deploy (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:45:00 +08:00

33 lines
817 B
Python

from __future__ import annotations
from pathlib import Path
import pytest
from openharness.ui.runtime import build_runtime, close_runtime
class _ClosableApiClient:
def __init__(self) -> None:
self.closed = False
async def stream_message(self, request):
del request
if False:
yield None
async def close(self) -> None:
self.closed = True
@pytest.mark.asyncio
async def test_close_runtime_closes_api_client(tmp_path: Path, monkeypatch):
monkeypatch.setenv("OPENHARNESS_CONFIG_DIR", str(tmp_path / "config"))
monkeypatch.setenv("OPENHARNESS_DATA_DIR", str(tmp_path / "data"))
client = _ClosableApiClient()
bundle = await build_runtime(cwd=str(tmp_path), api_client=client)
await close_runtime(bundle)
assert client.closed is True