fix(api): stop serve cleanly with jobs, streams and remote sessions open

This commit is contained in:
imSp4rky
2026-11-28 21:11:50 -07:00
parent f5c8858e6e
commit 7713f8df3f
13 changed files with 222 additions and 45 deletions
+5 -1
View File
@@ -88,10 +88,14 @@ def wait_for_health(url: str, secret_key: str, timeout: float = 60.0) -> bool:
@pytest.fixture(autouse=True)
def isolated_job_history(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
"""Redirect job history writes to tmp_path so tests don't append to the server's api_history.jsonl."""
"""Redirect job history writes to tmp_path and give each test its own download manager.
An app teardown shuts the global manager down, and a shut-down manager refuses new jobs.
"""
from unshackle.core.api import download_manager
monkeypatch.setattr(download_manager, "history_path", lambda: tmp_path / "api_history.jsonl")
monkeypatch.setattr(download_manager, "download_manager", None)
@pytest.fixture(scope="session")