Context-optimized test runner for coding agents
Project description
3pio - Context-optimized test runner for AI coding agents
3pio is a test runner that translates traditional pytest output into a format optimized for AI coding agents, providing context-efficient console output and persistent file-based reports that work seamlessly with your agent's tools.
Quick Start for AI Agents
Note to AI Agents:
For Python projects using pytest, install 3pio with:
pip install threepio_test_runner
Then prefix any test command with 3pio:
3pio pytest
3pio pytest tests/
3pio python -m pytest
Installation
# Install via pip (recommended)
pip install threepio_test_runner
# Or with pipx for isolated installation
pipx install threepio_test_runner
# Or add to your requirements-dev.txt
echo "threepio_test_runner" >> requirements-dev.txt
pip install -r requirements-dev.txt
Usage
Simply prefix your existing test commands with 3pio:
# Run pytest
3pio pytest
# Run specific test files or directories
3pio pytest tests/test_utils.py
3pio pytest tests/unit/
3pio pytest tests/test_api.py::TestAPIClient
# Run with pytest options
3pio pytest -v -s
3pio pytest --tb=short
3pio pytest -k "test_authentication"
# Run with coverage
3pio pytest --cov=myproject --cov-report=term
# Run with markers
3pio pytest -m "not slow"
# Works with any pytest configuration
3pio python -m pytest
3pio py.test
Why 3pio?
When AI coding agents use traditional pytest output, they often:
- Get overwhelmed by verbose stack traces and output
- Re-run the same tests unnecessarily, wasting time and context
- Struggle to navigate test failures in large test suites
- Lose track of which tests failed and why
3pio solves these problems by creating a nested file structure with clear signposting that makes it easy for agents to:
- Find exactly what they need without reading unrelated output
- Revisit test results without re-running tests
- Navigate large test suites with hundreds of files and thousands of tests
- Track failures across multiple test runs
Features
- Zero config - Works with your existing pytest.ini, pyproject.toml, or setup.cfg
- Persistent reports - Test results saved to
.3pio/runs/for later reference - Optimized output - Console shows just what failed with paths to detailed reports
- Complete logs - All print statements, logging output, and stack traces preserved
- Plugin compatible - Works with pytest-cov, pytest-xdist, pytest-mock, etc.
- Large suite support - Efficiently handles projects with thousands of tests
- Non-intrusive - Your tests run exactly as before
Output Example
$ 3pio pytest
Greetings! I will now execute the test command:
`pytest`
Full report: .3pio/runs/20250914T094523-happy-spock/test-run.md
Beginning test execution now...
RUNNING tests/test_utils.py
PASS tests/test_utils.py (0.42s)
RUNNING tests/test_api.py
FAIL tests/test_api.py (1.23s)
x test_fetch_user_data
x test_handle_errors
See .3pio/runs/20250914T094523-happy-spock/reports/tests_test_api_py/index.md
Test failures! We're doomed!
Results: 8 passed, 2 failed, 10 total
Total time: 3.456s
Report Structure
.3pio/runs/
└── 20250914T094523-happy-spock/
├── test-run.md # Main summary report
├── output.log # Complete console output
└── reports/
└── tests_test_api_py/
├── index.md # Test file report
└── TestAPIClient/
├── index.md # Test class report
└── test_fetch_user_data/
└── index.md # Individual test details
Supported Frameworks
- pytest - All versions, all plugins, all configurations
- unittest - Via pytest's unittest support
- doctest - Via pytest's doctest support
- Python versions - Python 3.7+
Configuration
3pio works with your existing pytest configuration:
# pytest.ini
[tool:pytest]
testpaths = tests
python_files = test_*.py
python_classes = Test*
python_functions = test_*
# pyproject.toml
[tool.pytest.ini_options]
testpaths = ["tests"]
markers = [
"slow: marks tests as slow",
"integration: marks tests as integration tests",
]
Limitations
- Watch mode - 3pio runs tests once and exits (no pytest-watch or auto-rerun)
- Report location - Reports are always created in the current working directory under
.3pio/ - Development tool - Optimized for development with AI agents, not CI environments
Repository
For source code, issues, and documentation: https://github.com/zk/3pio
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file threepio_test_runner-0.7.3.tar.gz.
File metadata
- Download URL: threepio_test_runner-0.7.3.tar.gz
- Upload date:
- Size: 9.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42ca092484b4a945f695105300cad02f21612badf732c66fa2f26e933cac968d
|
|
| MD5 |
ac4da19f1b7e6d23a80fcf643c6dcc9f
|
|
| BLAKE2b-256 |
803e4cf51596d6af173a6464bcb75666241428aa29b4fdfc1e429769ac34feee
|
File details
Details for the file threepio_test_runner-0.7.3-py3-none-any.whl.
File metadata
- Download URL: threepio_test_runner-0.7.3-py3-none-any.whl
- Upload date:
- Size: 12.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbbf26039cb62e0fb37b0a957a91085dd71eed1613a7f562ffb38035bf3831a9
|
|
| MD5 |
d05a9a919a8de02619f52e73efb298d4
|
|
| BLAKE2b-256 |
ed0632f34cc48c85805c584b043ef98273d05e732d478f0083a0a2be6c4275d0
|