testing._run_test

(internal) Run a single test with error handling and optional runner middleware. Every test races against a `timeout_ms` deadline (a non-positive value means no deadline, so no timer is spawned; the CLI defaults it to 5 minutes and `--test-timeout` overrides): a hung test — a stalled network read, a deadlocked await — becomes a FAIL with a "timed out" message instead of hanging the whole run. `baml.future.race` cancels the losers when one side settles (BEP-034), so a timed-out body is actively cancelled and a finished test's leftover timer doesn't linger.

Reference version

Signature

function testing._run_test(
runner: testing.TestRunner | null,
timeout_ms: int
) -> testing.TestReport throws never

(internal) Run a single test with error handling and optional runner middleware. Every test races against a timeout_ms deadline (a non-positive value means no deadline, so no timer is spawned; the CLI defaults it to 5 minutes and --test-timeout overrides): a hung test — a stalled network read, a deadlocked await — becomes a FAIL with a "timed out" message instead of hanging the whole run. baml.future.race cancels the losers when one side settles (BEP-034), so a timed-out body is actively cancelled and a finished test's leftover timer doesn't linger.

Source:<builtin>/testing/registry.bamlbytes 20854–24602