Skip to main content
Ask AI

Configuration

Every behavior is controlled by a pytest flag with a matching environment variable. CLI flags take precedence over environment variables.

Full reference

FlagEnv varDefaultPurpose
--testrelic-pytest-disableTESTRELIC_DISABLE=1offForce-disable the plugin
--testrelic-pytest-api-key VALUETESTRELIC_API_KEYAPI key from the dashboard
--testrelic-pytest-endpoint URLTESTRELIC_CLOUD_ENDPOINThttps://platform.testrelic.ai/api/v1Cloud base URL
--testrelic-pytest-upload-strategy {batch,realtime,both,none}TESTRELIC_UPLOAD_STRATEGYbatchWhen to send results
--testrelic-pytest-quietTESTRELIC_QUIET=1offSuppress banner output
--testrelic-pytest-run-type {smoke,regression,nightly,ci}TESTRELIC_RUN_TYPEDashboard bucket
--testrelic-pytest-project-name NAMETESTRELIC_PROJECT_NAMEgit remote or pyproject nameStable project identity
--testrelic-pytest-artifact-threshold-kb N32Output beyond N KB truncated inline
--testrelic-pytest-output PATHOptional JSON dump for debugging
--testrelic-pytest-no-autodetectTESTRELIC_NO_AUTODETECT=1offDisable httpx/requests HTTP auto-detection
--testrelic-pytest-no-capture-bodiesTESTRELIC_NO_CAPTURE_BODIES=1offDon't capture request/response bodies
--testrelic-pytest-no-capture-headersTESTRELIC_NO_CAPTURE_HEADERS=1offDon't capture request/response headers
--testrelic-pytest-no-capture-assertionsTESTRELIC_NO_CAPTURE_ASSERTIONS=1offDon'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:

ValueBehavior
batchSend results at the end of the run (default)
realtimeSend results as tests complete
bothSend both in realtime and as a batch
noneDon'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:

ToggleEffect
--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.