Files
Artemis-Eapil/tests/unit/test_source_archive.py
T
chenmingxuan 8e757d4626
CI / Python 3.12 / ubuntu-latest (push) Canceled after 0s
CI / Python 3.12 / windows-latest (push) Canceled after 0s
CI / Frontend tests and production build (push) Canceled after 0s
CI / Build and smoke-test Python packages (push) Canceled after 0s
fix: exclude local Roo MCP settings from source archives
2026-09-22 23:51:41 +08:00

37 lines
1.3 KiB
Python

import importlib.util
from pathlib import Path
import zipfile
def test_archive_keeps_source_and_excludes_local_builds_and_secrets(tmp_path):
script = Path(__file__).resolve().parents[2] / "scripts/package_source.py"
spec = importlib.util.spec_from_file_location("package_source", script)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
keep = ["start.bat", ".env.example", "uv.lock", "apps/showcase_ui/src/main.ts"]
omit = [
".env",
".env.local",
".venv/pyvenv.cfg",
"nested/node_modules/foo.js",
"apps/showcase_ui/dist/main.js",
"artemis/resources/showcase_ui/main.js",
"__pycache__/a.pyc",
"traces/data.db",
"helper.apk",
"debug.keystore",
".git/config",
".roo/mcp.json",
]
for name in keep + omit:
target = tmp_path / name
target.parent.mkdir(parents=True, exist_ok=True)
target.write_text("fixture")
output = tmp_path / "artifacts/source.zip"
count, digest = module.package_source(tmp_path, output)
assert count == len(keep)
assert len(digest) == 64
with zipfile.ZipFile(output) as archive:
assert archive.testzip() is None
assert set(archive.namelist()) == {f"artemis/{name}" for name in keep}