google/dev-testing-python
Python test infrastructure for the capsem-builder package. Use when running Python tests, checking coverage, debugging test failures, working with golden fixtures, or generating schemas. Covers pytest config, coverage floors, cross-language conformance tests, and the schema generation pipeline.
npx skills add https://github.com/google/capsem --skill dev-testing-python
uv run python -m pytest tests/ # All tests
uv run python -m pytest tests/ --cov=src/capsem --cov-fail-under=85 # With coverage
uv run python -m pytest tests/test_validate.py -k "test_E001" # Single test
just test # Full suite (Rust + Python + frontend)
just schema # Regenerate JSON schema + defaults
pyproject.toml:
capsem, entry point capsem-builder = capsem.builder.cli:mainsrc/capsempytest>=8.0, pytest-cov>=6.0 (in [dependency-groups] dev)testpaths = ["tests"]tests/| File | Tests | What it covers |
|------|-------|----------------|
| test_validate.py | 96 | TOML config linting, error codes E001-E305, warnings W001-W012 |
| test_models.py | 80 | Pydantic models (GuestImageConfig, ArchConfig, all sub-models) |
| test_cli.py | 18 | Backend-only Click CLI surface; product build/validate/inspect commands stay burned |
| test_docker.py | 75 | Jinja Dockerfile rendering, conformance with legacy Dockerfiles |
| test_settings_spec.py | 73 | Settings schema conformance (golden fixture round-trip) |
| test_manifest.py | 48 | BOM collection, manifest rendering, dpkg/pip/npm parsers |
| test_config.py | 41 | TOML config loading, defaults generation, roundtrip |
| test_doctor.py | 27 | Build doctor checks (Docker, tools, disk, permissions) |
| test_mcp.py | 20 | JSON-RPC 2.0 MCP stdio server |
| test_audit.py | 20 | Trivy/grype JSON parsing, severity summary |
--cov-fail-under=85 in just testcodecov-python.xml (XML for CI upload)src/capsem/**, included in unit flagGolden fixture at tests/settings_spec/golden.json with expected output at tests/settings_spec/expected.json. Three language parsers must produce identical results:
| Language | Test file | Tests |
|----------|-----------|-------|
| Python | tests/test_settings_spec.py | 73 |
| Rust | crates/capsem-core/tests/settings_spec.rs | 12 |
| TypeScript | frontend/src/lib/__tests__/settings_spec.test.ts | 14 |
If you change the settings schema (node types, metadata fields), all three must be updated together.
config/settings/settings.toml -> Pydantic models -> config/settings/schema.generated.json (JSON Schema)
-> config/settings/ui-metadata.generated.json (UI metadata)
just schema runs generate_schema.py which calls export_json_schema() and generate_defaults_json()config/settings/ui-metadata.generated.json via include_str!() in registry.rsconfig/settings/schema.generated.json in conformance testsguest/artifacts/diagnostics/ contains 207 pytest tests that run INSIDE the VM via just exec "capsem-doctor". These are NOT part of the host uv run pytest suite. They test the guest environment (mounts, networking, sandbox, MCP, runtimes). See /dev-testing-vm for details.
src/capsem/
__init__.py
builder/
__init__.py
cli.py Backend-only Click CLI entry point
config.py TOML config loading, defaults generation
models.py Pydantic models (GuestImageConfig, ArchConfig, etc.)
schema.py Settings schema (SettingsRoot, GroupNode, SettingNode)
docker.py Jinja Dockerfile rendering, Docker build execution
manifest.py BOM collection, manifest rendering
validate.py Compiler-style linting with error codes
audit.py Trivy/grype output parsing
image_build_backend.py Private capsem-admin image build backend
doctor.py Build environment doctor checks
templates/
Dockerfile.rootfs.j2
Dockerfile.kernel.j2
Take google/dev-testing-python from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.