CLI¶
The itest command¶
itest is a thin wrapper around pytest with --inline-tests enabled:
Equivalent to:
Passing arguments¶
All pytest arguments work:
# Verbose output
itest -v
# Run specific file
itest src/auth/login.py
# Run specific test
itest -k "test_name"
# Stop on first failure
itest -x
# Show print output
itest -s
Common patterns¶
# Run only inline tests in src/
itest src/
# Run with coverage
itest --cov=src
# Run in parallel
itest -n auto
# Run specific markers
itest -m "not slow"
Exit codes¶
Standard pytest exit codes:
| Code | Meaning |
|---|---|
| 0 | All tests passed |
| 1 | Some tests failed |
| 2 | Test execution interrupted |
| 3 | Internal error |
| 4 | pytest usage error |
| 5 | No tests collected |
Production builds¶
Ship as-is. The @test decorator is a no-op at runtime. Tests never execute unless you run itest. Zero overhead.
Strip tests. Remove @test functions before packaging:
Build system integration¶
uv_build — No transform hooks. Strip separately, then build:
hatchling — Supports build hooks. A future inline-tests-hatch plugin could strip automatically during hatch build.
Both produce identical results. Choose based on your existing toolchain.