Skip to main content

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

  1. Watch mode - 3pio runs tests once and exits (no pytest-watch or auto-rerun)
  2. Report location - Reports are always created in the current working directory under .3pio/
  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

threepio_test_runner-0.7.2.tar.gz (9.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

threepio_test_runner-0.7.2-py3-none-any.whl (11.9 MB view details)

Uploaded Python 3

File details

Details for the file threepio_test_runner-0.7.2.tar.gz.

File metadata

  • Download URL: threepio_test_runner-0.7.2.tar.gz
  • Upload date:
  • Size: 9.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for threepio_test_runner-0.7.2.tar.gz
Algorithm Hash digest
SHA256 bb30ba4b3fe88060f642be2907be53cab19496f4e68748eb75935b5a08af69ab
MD5 f24d6b08dab073a3894f6b8cbbf84f72
BLAKE2b-256 3c60f5cc0d4f014f45de292cee7445400bd66436e9225f366ef6fee29bc42f61

See more details on using hashes here.

File details

Details for the file threepio_test_runner-0.7.2-py3-none-any.whl.

File metadata

File hashes

Hashes for threepio_test_runner-0.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 411d570897529659b67985a6796bc4d5a4f1e144ae802c492bcc5a32b85702dd
MD5 bef130ccd7a52482c0a064b7b6499551
BLAKE2b-256 5fdc6c758f5dbdae7700603f2ad87868bc1bf4c2d1ef9c09e32a6bad66daef86

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page