Skip to content

CLI

The itest command

itest is a thin wrapper around pytest with --inline-tests enabled:

itest

Equivalent to:

pytest --inline-tests

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:

itest strip src/ -o dist/

Build system integration

uv_build — No transform hooks. Strip separately, then build:

itest strip src/ -o build/src
cd build && uv 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.