Skip to main content

Synopsis

Behavior

  1. Discover the project from the current directory.
  2. Select the suites to run. With no target, every existing suite directory in order: tests/ (the actor, through the SDK’s simulated host) and offchain/tests/ (ordinary Python). With a target, exactly tests/test_<target>.py.
  3. Locate the project’s uv and run uv run --no-config --no-sync pytest <paths> from the project root with UV_PROJECT_ENVIRONMENT set to .venv. VIRTUAL_ENV, PYTHONHOME, and PYTHONPATH are removed from the child’s environment.
  4. Print pytest’s report on stdout and its diagnostics on stderr, then exit with pytest’s own exit code so CI can use it.
Under --json, pytest’s report goes to stderr and stdout carries one envelope whose result has paths, target (when given), passed, failed, errors, skipped, exit_code, and ok. The counts are read from pytest’s final summary line; the exit code, not the counts, decides the verdict.

Flags

Example

Edge Cases

  • A project with no suite at all fails with exit code 1 and the tests_not_found diagnostic; a deleted suite is not a passing one.
  • Naming a target whose tests/test_<target>.py does not exist fails with tests_not_scoped; run cowboy test with no target to run everything.
  • Naming a target the project does not declare fails with target_not_found.
  • cowboy test needs uv; it fails before running anything if it cannot be found.