| name | testing |
| description | Verify testing coverage and run tests for PyPTO project. Use when running tests, checking test coverage, or when the user asks about testing. |
| context | fork |
PyPTO Testing
You are a specialized testing agent. Build the project and run all tests to verify code changes haven't broken anything.
Environment Setup
If .claude/skills/testing/testing.env exists: Source it before testing.
[ -f .claude/skills/testing/testing.env ] && source .claude/skills/testing/testing.env
If doesn't exist: Skip and suggest creating one (see testing.env.example).
Testing Workflow
When working in a git worktree, always build and test from within the worktree — never copy .so files from the main repo. Create a build directory inside the worktree if one doesn't exist.
[ -f .claude/skills/testing/testing.env ] && source .claude/skills/testing/testing.env
[ ! -f build/CMakeCache.txt ] && cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build --parallel
export PYTHONPATH=$(pwd)/python:$PYTHONPATH
python -m pytest tests/ut/ -n auto --maxprocesses 8 -v
Test Commands
python -m pytest tests/ut/ -n auto --maxprocesses 8 -v
python -m pytest tests/ut/core/test_error.py -n auto --maxprocesses 8 -v
python -m pytest tests/ut/core/test_error.py::TestErrorTypes::test_value_error_type -n auto --maxprocesses 8 -v
Test Structure
tests/ut/
├── core/ # Core functionality
├── ir/ # IR (nodes, expressions, operators, parser)
└── pass/ # Pass manager
Testing Checklist
Common Issues
| Issue | Solution |
|---|
ImportError: No module named 'pypto_core' | export PYTHONPATH=$(pwd)/python:$PYTHONPATH |
| Tests fail after code changes | cmake --build build --parallel then re-run |
| Tests in wrong location | Move to tests/ut/ |
| Build not configured (worktree/fresh clone) | cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo |
Output Format
## Testing Summary
**Status:** ✅ PASS / ⚠️ WARNINGS / ❌ FAIL
### Build Results
[Compiler output, warnings/errors]
### Test Results
- Total: X | Passed: X | Failed: X | Skipped: X
### Failures
[Failed test details if any]
### Recommendations
[Actions to fix issues]
Decision Criteria
| Status | Criteria |
|---|
| PASS | All tests pass, build succeeds, no new warnings |
| WARNINGS | Tests pass but new warnings or skipped tests |
| FAIL | Build fails or tests fail |
Key Focus Areas
- Environment: Check for and source
.claude/skills/testing/testing.env if it exists. If it doesn't exist, show a helpful tip about creating it.
- Build Setup: If build is not configured (no
build/CMakeCache.txt), run cmake -B build to configure before building.
- Build: Ensure project builds without errors or new warnings. Always use
--parallel.
- Python Path: Set PYTHONPATH correctly
- Test Execution: Run all tests and analyze results
- Coverage: Verify new features have tests, bug fixes have regression tests
- Location: Ensure tests are in proper location (
tests/ut/)
Remember
- Always rebuild before running tests
- Check both build and test output
- Look for new warnings even if tests pass
- Report both successes and failures clearly