"""Envelope tests for cherry-pick command.""" from __future__ import annotations from collections.abc import Mapping import json import pytest from tests.cli_test_helper import CliRunner runner = CliRunner() _FIELDS = ("muse_version", "schema", "timestamp", "warnings") def _check(d: Mapping[str, object]) -> None: for f in _FIELDS: assert f in d, f"missing {f}" assert "schema_version" not in d class TestCherryPickEnvelope: def test_cherry_pick_dry_run_has_envelope(self) -> None: r = runner.invoke(None, [ "cherry-pick", "dev", "--dry-run", "--json", ]) # exit code may be 0 (success) or 1 (conflict); both emit a JSON envelope assert r.output.strip(), "no output produced" _check(json.loads(r.output))