Skip to content

Running tests

Basic usage

Run all tests in your project:

tryke test

Or without installing:

uvx tryke test

Specifying paths

Pass one or more file or directory paths to restrict which tests are collected:

tryke test tests/test_math.py
tryke test tests/unit/ tests/integration/

file:line syntax

Jump to a specific test by pointing at the line where it's defined:

tryke test tests/test_math.py:12

tryke runs the test whose definition spans that line. This is especially useful from editor integrations that can resolve the cursor position.

Collecting without running

Use --collect-only to list discovered tests without executing them:

tryke test --collect-only

This is useful for verifying filtering expressions or checking that tryke sees your tests.

Stopping on failure

Stop after the first failure with -x / --fail-fast:

tryke test -x

Stop after N failures with --maxfail:

tryke test --maxfail 3

Parallel execution

tryke runs tests in parallel by default. The worker count defaults to min(test_count, cpu_count). Override with -j / --workers:

tryke test -j 4

See concurrency for details on the worker pool model.

Project root

By default tryke uses the current directory as the project root. Override with --root:

tryke test --root /path/to/project

The root determines where tryke looks for pyproject.toml, test files, and the import graph.

Filtering

See the filtering guide for -k expressions, -m tag filters, and how to combine them.

Reporter format

Choose an output format with --reporter:

tryke test --reporter dot
tryke test --reporter json

See the reporters guide for all available formats.

Connecting to a server

If you have a tryke server running, connect to it for faster runs:

tryke test --port
tryke test --port 2337

The server keeps Python workers warm and caches test discovery, so subsequent runs skip startup overhead.