Files
Jyotisha/tests/test_skill_release_clean_trial.py
T
Jesse_Chen 2415e751fe chore(repo): make the release gate reproducible and clean product URLs
PyJHora absence is now partial, tests write research manifests to tmp, the registry allows experimental_variant, and product links point at the Gitea repo. Early logs move to docs/history.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-03 16:55:26 +08:00

74 lines
2.3 KiB
Python

from __future__ import annotations
import json
import subprocess
import sys
import zipfile
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def test_premium_skill_zip_runs_from_clean_directory(tmp_path: Path) -> None:
zip_path = tmp_path / "jyotish-premium.zip"
release = subprocess.run(
[
sys.executable,
"scripts/skill_release_package.py",
"--edition",
"premium_cloud_drive",
"--write-zip",
str(zip_path),
],
cwd=ROOT,
text=True,
capture_output=True,
timeout=120,
check=False,
)
assert release.returncode == 0, release.stderr or release.stdout
extract_dir = tmp_path / "clean"
with zipfile.ZipFile(zip_path) as archive:
archive.extractall(extract_dir)
required = [
"INSTALL.md",
"USER_PROMPTS.md",
"SALES_PACKAGE.md",
"GUIDED_ENTRYPOINT.md",
"PACKAGE_ACCEPTANCE.json",
"references/real_case_calibration/replay_manifest.json",
"references/oracle/three_engine_parity_replay_manifest.json",
"references/oracle/western_oracle_adapter_contract.md",
]
assert [path for path in required if not (extract_dir / path).exists()] == []
acceptance = json.loads((extract_dir / "PACKAGE_ACCEPTANCE.json").read_text(encoding="utf-8"))
assert acceptance["status"] == "pass"
privacy = subprocess.run(
[sys.executable, "scripts/public_release_privacy_scan.py"],
cwd=extract_dir,
text=True,
capture_output=True,
timeout=120,
check=False,
)
assert privacy.returncode == 0, privacy.stderr or privacy.stdout
user_acceptance = subprocess.run(
[sys.executable, "scripts/user_invocation_acceptance_check.py"],
cwd=extract_dir,
text=True,
capture_output=True,
timeout=240,
check=False,
)
assert user_acceptance.returncode == 0, user_acceptance.stderr or user_acceptance.stdout
report = json.loads(user_acceptance.stdout)
# 原值=status 必须 pass;新值=pass 或 partial;原因=打包目录里缺 PyJHora 时应降级而不是 fail
assert report["status"] in {"pass", "partial"}
assert report["checks"]["guided_topics_entrypoint"] is True