Cherry-pick heuristics, manifest merge, global file search, scrollbar styling, and pytest/Playwright coverage unblock review and filtered export for mmetl.
50 lines
1.6 KiB
Python
50 lines
1.6 KiB
Python
"""Integration test for auto-cherry-pick main() on mini-export."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
REPO = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
@pytest.fixture
|
|
def cherry_pick_module():
|
|
import importlib.util
|
|
|
|
path = REPO / "scripts" / "auto-cherry-pick.py"
|
|
spec = importlib.util.spec_from_file_location("auto_cherry_pick_main", path)
|
|
mod = importlib.util.module_from_spec(spec)
|
|
assert spec.loader
|
|
spec.loader.exec_module(mod)
|
|
return mod
|
|
|
|
|
|
def test_main_dry_run_on_fixture(cherry_pick_module, fixture_export_path, tmp_path, monkeypatch):
|
|
manifest = tmp_path / "manifest.json"
|
|
monkeypatch.setattr(cherry_pick_module, "MANIFEST_PATH", manifest)
|
|
monkeypatch.setattr(cherry_pick_module, "DEFAULT_EXPORT", fixture_export_path)
|
|
monkeypatch.setattr(sys, "argv", ["auto-cherry-pick.py", "--dry-run"])
|
|
assert cherry_pick_module.main() == 0
|
|
|
|
|
|
def test_main_writes_pick_manifest(cherry_pick_module, fixture_export_path, tmp_path, monkeypatch):
|
|
manifest = tmp_path / "manifest.json"
|
|
monkeypatch.setattr(cherry_pick_module, "MANIFEST_PATH", manifest)
|
|
monkeypatch.setattr(cherry_pick_module, "DEFAULT_EXPORT", fixture_export_path)
|
|
monkeypatch.setattr(sys, "argv", ["auto-cherry-pick.py"])
|
|
assert cherry_pick_module.main() == 0
|
|
data = json.loads(manifest.read_text())
|
|
picks = sum(
|
|
1
|
|
for ch in data["channels"].values()
|
|
for m in ch.get("messages", {}).values()
|
|
if m.get("action") == "import"
|
|
)
|
|
assert picks > 0
|
|
assert "medical" in data["channels"]
|
|
assert data["channels"]["medical"]["import_mode"] == "pick"
|