Skip to main content
Ask AI

Package Overview

testrelic-pytest is published on PyPI (current version 0.3.1).

Terminal
pip install testrelic-pytest

The plugin model

The package registers itself through a pytest11 entry point. There is nothing to import and no conftest.py wiring — once the package is installed in the same environment as pytest, the plugin is active on the next pytest run.

Requirements: Python >=3.9, pytest>=7.0, httpx>=0.27.

Flags and environment variables

Every pytest option has a matching environment variable. CLI flags take precedence over environment variables.

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

CLI commands

Installing the package also installs a testrelic-pytest CLI:

CommandPurpose
testrelic-pytest versionPrint the installed version
testrelic-pytest drain [--queue-dir PATH]Retry queued failed uploads
testrelic-pytest status [--queue-dir PATH]Show the pending replay count

The offline queue directory defaults to .testrelic/queue/ (project-local).

Was this page helpful?
Last updated on by Srivishnu Ayyagari