Skip to main content

Generic pytest reporter that uploads test results to the TestRelic AI cloud platform.

Project description

testrelic-pytest

PyPI

Generic pytest reporter that ships your test results to the TestRelic AI cloud platform. Works with any pytest project — unit tests, API tests, integration tests — and stays out of the way when no API key is configured.

Install

pip install testrelic-pytest

The plugin auto-registers via the pytest11 entry point. Nothing to import.

Configure

export TESTRELIC_API_KEY=tr_live_...
pytest

The plugin silently no-ops when TESTRELIC_API_KEY is unset, so it is safe to add to any project.

Options

All options can be set via CLI flag, environment variable, or a JSON file at .testrelic/testrelic-config.json. Precedence (highest first): CLI flag → environment → JSON file → defaults.

CLI flags use a --testrelic-pytest-* prefix so they don't collide with the testrelic-playwright plugin if both are installed.

CLI 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 TestRelic 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 Captured output beyond N KB is truncated inline.
--testrelic-pytest-output PATH Optional JSON dump for debugging.

Config file (.testrelic/testrelic-config.json)

{
  "apiKey": "$TESTRELIC_API_KEY",
  "endpoint": "https://platform.testrelic.ai/api/v1",
  "upload": "batch",
  "projectName": "my-suite",
  "artifactThresholdKb": 32,
  "uploadArtifacts": true,
  "queueDirectory": ".testrelic/queue",
  "metadata": { "team": "platform" }
}

$ENV_VAR strings are expanded against the process environment at startup.

What gets captured

For each test the plugin captures:

  • nodeId, file, className, testName, parametrizeId
  • Outcome: passed | failed | skipped | xfailed | xpassed | error
  • Duration (ms) and per-phase breakdown (setup/call/teardown)
  • Markers (e.g. @pytest.mark.smoke), keywords, parametrize ids
  • Skip reasons and pytest warnings
  • Failure tracebacks and assertion repr
  • Captured stdout / stderr / caplog (inline with redaction; truncated above --testrelic-artifact-threshold-kb, hard cap 1 MB per stream — artifact upload for large streams is planned for v0.2)

Test runs include CI metadata auto-detected from GitHub Actions, GitLab CI, Jenkins, and CircleCI, plus git branch/commit/author from the working tree.

pytest-xdist

Parallel runs via pytest-xdist (pytest -n 4) are supported out of the box. Each worker forwards its TestReport objects through the xdist channel; only the controller node uploads. The result is exactly one cloud run with all tests aggregated.

Offline mode

Any upload that fails after retries is written to ~/.testrelic/queue/ as a JSON file. Re-run later:

testrelic-pytest drain

The drainer re-authenticates with TESTRELIC_API_KEY and replays each entry to its original endpoint.

See also

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

testrelic_pytest-0.3.1.tar.gz (48.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

testrelic_pytest-0.3.1-py3-none-any.whl (60.7 kB view details)

Uploaded Python 3

File details

Details for the file testrelic_pytest-0.3.1.tar.gz.

File metadata

  • Download URL: testrelic_pytest-0.3.1.tar.gz
  • Upload date:
  • Size: 48.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for testrelic_pytest-0.3.1.tar.gz
Algorithm Hash digest
SHA256 c93d7499942bf6eabf9c69ebb158b38b5b78437c77c2f6f0e6cbd10dd3d7cca9
MD5 c10a132c5aa6607f3ce1d3cd0f767a79
BLAKE2b-256 c0c9b66557c736fbf5f145d893560e9690bd2393f2229960c5f89191020f6cba

See more details on using hashes here.

Provenance

The following attestation bundles were made for testrelic_pytest-0.3.1.tar.gz:

Publisher: publish-pytest-prod.yml on testrelic-ai/testrelic-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file testrelic_pytest-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for testrelic_pytest-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b6ec64c96b83b3c5be64c3d9a05a93f1d35e73aae3aa5d3bee40e211e5ee0dbb
MD5 d86aeb53241020ed841a665ef6a7fc1e
BLAKE2b-256 7bb227ad2667db072d7ad3c3cbb06d9a40cedf694a2f554e2e1aaa2199fe4348

See more details on using hashes here.

Provenance

The following attestation bundles were made for testrelic_pytest-0.3.1-py3-none-any.whl:

Publisher: publish-pytest-prod.yml on testrelic-ai/testrelic-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page