Configuration
Every behavior is controlled by a pytest flag with a matching environment variable. CLI flags take precedence over environment variables.
Full reference
| Flag | Env var | Default | Purpose |
|---|---|---|---|
--testrelic-pytest-disable | TESTRELIC_DISABLE=1 | off | Force-disable the plugin |
--testrelic-pytest-api-key VALUE | TESTRELIC_API_KEY | — | API key from the dashboard |
--testrelic-pytest-endpoint URL | TESTRELIC_CLOUD_ENDPOINT | https://platform.testrelic.ai/api/v1 | Cloud base URL |
--testrelic-pytest-upload-strategy {batch,realtime,both,none} | TESTRELIC_UPLOAD_STRATEGY | batch | When to send results |
--testrelic-pytest-quiet | TESTRELIC_QUIET=1 | off | Suppress banner output |
--testrelic-pytest-run-type {smoke,regression,nightly,ci} | TESTRELIC_RUN_TYPE | — | Dashboard bucket |
--testrelic-pytest-project-name NAME | TESTRELIC_PROJECT_NAME | git remote or pyproject name | Stable project identity |
--testrelic-pytest-artifact-threshold-kb N | — | 32 | Output beyond N KB truncated inline |
--testrelic-pytest-output PATH | — | — | Optional JSON dump for debugging |
--testrelic-pytest-no-autodetect | TESTRELIC_NO_AUTODETECT=1 | off | Disable httpx/requests HTTP auto-detection |
--testrelic-pytest-no-capture-bodies | TESTRELIC_NO_CAPTURE_BODIES=1 | off | Don't capture request/response bodies |
--testrelic-pytest-no-capture-headers | TESTRELIC_NO_CAPTURE_HEADERS=1 | off | Don't capture request/response headers |
--testrelic-pytest-no-capture-assertions | TESTRELIC_NO_CAPTURE_ASSERTIONS=1 | off | Don't capture pytest assert statements |
The cloud request timeout is set with TESTRELIC_CLOUD_TIMEOUT (milliseconds).
Upload strategy
--testrelic-pytest-upload-strategy decides when results are transmitted:
| Value | Behavior |
|---|---|
batch | Send results at the end of the run (default) |
realtime | Send results as tests complete |
both | Send both in realtime and as a batch |
none | Don't upload |
Run-type buckets
--testrelic-pytest-run-type groups runs on the dashboard. Valid buckets: smoke, regression, nightly, ci. When unset, the run is not assigned a bucket.
Capture toggles
By default the plugin captures HTTP request/response bodies and headers and pytest assertions. Each can be disabled:
| Toggle | Effect |
|---|---|
--testrelic-pytest-no-autodetect (TESTRELIC_NO_AUTODETECT=1) | Disable httpx/requests HTTP auto-detection |
--testrelic-pytest-no-capture-bodies (TESTRELIC_NO_CAPTURE_BODIES=1) | Don't capture request/response bodies |
--testrelic-pytest-no-capture-headers (TESTRELIC_NO_CAPTURE_HEADERS=1) | Don't capture request/response headers |
--testrelic-pytest-no-capture-assertions (TESTRELIC_NO_CAPTURE_ASSERTIONS=1) | Don't capture pytest assert statements |
Captured headers are masked for sensitive values, and bodies and captured streams are truncated.
Artifact threshold
--testrelic-pytest-artifact-threshold-kb (default 32) sets the size beyond which inline output is truncated. The same default applies to captured stdout/stderr/caplog streams (32 KB per stream).
Git and CI metadata
The plugin auto-detects CI metadata for GitHub Actions, GitLab CI, Jenkins, and CircleCI, plus the git branch, commit, and author. When .git is unavailable, it falls back to CI environment variables.
Project identity
--testrelic-pytest-project-name (env TESTRELIC_PROJECT_NAME) sets a stable project identity. When unset, the plugin derives it from the git remote or the pyproject name.