chore: auto release commit (2026-07-11 15:57:40)
All checks were successful
技能自动化发布 / release (push) Successful in 5s
All checks were successful
技能自动化发布 / release (push) Successful in 5s
This commit is contained in:
@@ -15,6 +15,46 @@ from _support import IsolatedDataRoot, get_skill_root
|
||||
from jiangchang_skill_core import config
|
||||
|
||||
|
||||
def _active_env_value(text: str, key: str) -> str | None:
|
||||
"""Return the active (non-comment) KEY=value line from .env-style text."""
|
||||
prefix = f"{key}="
|
||||
for line in text.splitlines():
|
||||
stripped = line.strip()
|
||||
if not stripped or stripped.startswith("#"):
|
||||
continue
|
||||
active = stripped.split("#", 1)[0].strip()
|
||||
if active.startswith(prefix):
|
||||
return active
|
||||
return None
|
||||
|
||||
|
||||
def _combined_service_source(skill_root: str | None = None) -> str:
|
||||
"""Merge scripts/service/*.py source (excludes __pycache__)."""
|
||||
root = skill_root or get_skill_root()
|
||||
service_dir = os.path.join(root, "scripts", "service")
|
||||
parts: list[str] = []
|
||||
for dirpath, dirnames, filenames in os.walk(service_dir):
|
||||
dirnames[:] = [d for d in dirnames if d != "__pycache__"]
|
||||
for name in sorted(filenames):
|
||||
if not name.endswith(".py"):
|
||||
continue
|
||||
path = os.path.join(dirpath, name)
|
||||
with open(path, encoding="utf-8") as f:
|
||||
parts.append(f.read())
|
||||
return "\n".join(parts)
|
||||
|
||||
|
||||
def _missing_video_integration_tokens(service_text: str) -> list[str]:
|
||||
missing: list[str] = []
|
||||
if "RpaVideoSession" not in service_text:
|
||||
missing.append("RpaVideoSession")
|
||||
if "video.add_step" not in service_text and ".add_step(" not in service_text:
|
||||
missing.append("video.add_step or .add_step(")
|
||||
if "merge_video_into_result_summary" not in service_text:
|
||||
missing.append("merge_video_into_result_summary")
|
||||
return missing
|
||||
|
||||
|
||||
class TestEnvExampleVideoDefaults(unittest.TestCase):
|
||||
def test_env_example_contains_required_keys(self) -> None:
|
||||
path = os.path.join(get_skill_root(), ".env.example")
|
||||
@@ -22,13 +62,45 @@ class TestEnvExampleVideoDefaults(unittest.TestCase):
|
||||
text = f.read()
|
||||
for key in (
|
||||
"OPENCLAW_" + "TEST_TARGET=mock",
|
||||
"OPENCLAW_RECORD_VIDEO=1",
|
||||
"OPENCLAW_RECORD_VIDEO=0",
|
||||
"OPENCLAW_ARTIFACTS_ON_FAILURE=1",
|
||||
"OPENCLAW_BROWSER_HEADLESS=0",
|
||||
"OPENCLAW_PLAYWRIGHT_STEALTH=1",
|
||||
):
|
||||
self.assertIn(key, text, msg=f"missing {key!r} in .env.example")
|
||||
|
||||
def test_env_example_default_off_but_template_keeps_video_integration(self) -> None:
|
||||
path = os.path.join(get_skill_root(), ".env.example")
|
||||
with open(path, encoding="utf-8") as f:
|
||||
text = f.read()
|
||||
self.assertEqual(
|
||||
_active_env_value(text, "OPENCLAW_RECORD_VIDEO"),
|
||||
"OPENCLAW_RECORD_VIDEO=0",
|
||||
)
|
||||
|
||||
service_text = _combined_service_source()
|
||||
missing = _missing_video_integration_tokens(service_text)
|
||||
self.assertEqual(
|
||||
missing,
|
||||
[],
|
||||
msg=(
|
||||
"default OPENCLAW_RECORD_VIDEO=0 does not allow removing video integration; "
|
||||
f"scripts/service/*.py missing: {', '.join(missing)}"
|
||||
),
|
||||
)
|
||||
|
||||
def test_env_example_allows_record_video_one_in_comments_only(self) -> None:
|
||||
sample = "\n".join(
|
||||
[
|
||||
"# example: OPENCLAW_RECORD_VIDEO=1 for production",
|
||||
"OPENCLAW_RECORD_VIDEO=0",
|
||||
]
|
||||
)
|
||||
self.assertEqual(
|
||||
_active_env_value(sample, "OPENCLAW_RECORD_VIDEO"),
|
||||
"OPENCLAW_RECORD_VIDEO=0",
|
||||
)
|
||||
|
||||
|
||||
class TestPrintVideoSummary(unittest.TestCase):
|
||||
def test_cli_prints_video_path_when_enabled(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user