init_testing_repo.sh — Initialize a repository for PMIverse testing
Path: /srv/pmiverse/_pmiconfig/scripts/test/init_testing_repo.sh
Purpose - Idempotently prepare any addon repository for PMIverse local‑first testing and badges. - Ensures baseline files/folders, testing scaffold, and optional README badges block.
What it does
- Creates .badges/tests/ and ensures .gitignore allows tracking *.svg badges.
- Ensures pytest.ini at repo root from the pmiconfig template (if missing).
- Runs the scaffold tool over all addons in the repo:
- /_pmiconfig/scripts/test/ensure_testing_scaffold.sh --repo <repo_root>
- Inserts a badges block at the top of README.md (three rows: Tests, per‑addon status, Coverage + per‑addon) unless already present. Use --force to rewrite.
- Installs pre-commit hooks if pre-commit is available and .pre-commit-config.yaml exists.
Usage
bash /srv/pmiverse/_pmiconfig/scripts/test/init_testing_repo.sh \
--repo /path/to/repo
Options
- --no-scaffold — skip running the scaffold tool
- --no-readme — skip modifying README
- --no-pre-commit — skip pre-commit install
- --force — overwrite an existing PMIverse badges block in README
- -h|--help — show help
Follow‑ups (optional)
- Run focused tests with run_pytest_addon.sh or run_pytest_repo.sh --addons.
- Publish reviewed badge artifacts explicitly with publish_repo_badges.sh.
Logs
- Script writes to /srv/pmiverse/logs/init_testing_repo_<timestamp>.log.