Files
mytoolkit/Makefile
T
Zhengshou Lai 06704acf60 test: add pytest suite — CLI smoke + config/templates/md_to_pdf units
- tests/conftest.py redirects MYTOOLKIT_HOME to a temp dir before imports
  so the module-level Config singleton never touches the real ~/.mytoolkit
- CLI smoke: every registered command answers --help with exit code 0
- unit tests: Config get/set/migrate, templates_registry override/fallback,
  md_to_pdf pure helpers (pandoc-dependent cases skipif-guarded)
- pyproject: dev dependency group (pytest) + pytest config; Makefile: make test
2026-07-18 11:45:40 +08:00

40 lines
1.2 KiB
Makefile

ROOT_DIR := $(shell pwd)
PYTHON ?= python3
.PHONY: help install uninstall sync-skill test
help:
@echo "Usage: make [target]"
@echo ""
@echo " install Install mytoolkit in editable mode (current Python) and sync skill"
@echo " sync-skill Copy the bundled agent skill to ~/.agents/skills/mytoolkit/"
@echo " test Run the pytest suite"
@echo " uninstall Uninstall mytoolkit and remove shell completions"
install:
$(PYTHON) -m pip install -e "$(ROOT_DIR)" --upgrade
@echo "Installing shell completions…"
@mytoolkit completion install || echo "Warning: completion install failed"
@$(MAKE) -s sync-skill
sync-skill:
@echo "Syncing agent skill to ~/.agents/skills/mytoolkit/ ..."
@mkdir -p "$(HOME)/.agents/skills"
@if command -v rsync >/dev/null 2>&1; then \
rsync -av --delete "$(ROOT_DIR)/.agents/skills/mytoolkit/" "$(HOME)/.agents/skills/mytoolkit/"; \
else \
rm -rf "$(HOME)/.agents/skills/mytoolkit"; \
cp -R "$(ROOT_DIR)/.agents/skills/mytoolkit" "$(HOME)/.agents/skills/mytoolkit"; \
fi
uninstall:
@mytoolkit uninstall || $(PYTHON) -m pip uninstall mytoolkit -y
test:
@cd "$(ROOT_DIR)" && \
if command -v uv >/dev/null 2>&1; then \
uv run pytest tests/ -q; \
else \
$(PYTHON) -m pytest tests/ -q; \
fi