Skip to main content

Pytest plugin that streams Allure test results to Testtrain in real time

Project description

testtrain-pytest-allure

A pytest plugin that streams Allure test results to Testtrain in real time using allure-python-commons hooks.

Each test result — including steps, parameters, attachments, and defect links — is posted to the Testtrain API immediately after the test finishes, with no file scanning required.

Installation

pip install testtrain-pytest-allure

Usage

pytest \
  --testtrain-url=http://localhost:3000 \
  --testtrain-auth-token=your-token \
  --alluredir=allure-results \
  --testtrain-run-id=testrun-id

The plugin activates automatically when all three --testtrain-* options are provided.

Environment variables

You can provide the Testtrain settings via environment variables instead of command-line options. The plugin prefers CLI options but will fall back to env vars when options are not given.

export TESTTRAIN_RUN_ID="your-run-uuid"
export TESTTRAIN_AUTH_TOKEN="your-token"
export TESTTRAIN_URL="https://testtrain.io" # Optional (defaults to https://testtrain.io)

Run pytest normally (use -s to show plugin logs):

pytest -k <one_test> -s

Options

Option Description
--testtrain-url Testtrain platform base URL
--testtrain-auth-token Bearer token for API authentication
--testtrain-run-id UUID of an existing testrun to report results to

How It Works

The plugin registers a listener into allure_commons.plugin_manager that implements the report_result hook. When Allure finalises a test (after teardown), the listener:

  1. Maps the TestResult object (status, steps, parameters, links) to the Testtrain API schema.
  2. Collects any in-memory attachment data captured during the test run.
  3. Sends everything to POST /api/tests (JSON or multipart when attachments are present).
  4. Retries up to 3 times on transient errors with exponential back-off.
  5. Stops the test session if all retries fail.

Development

cd plugins/testtrain-pytest-allure
uv sync
uv run pytest tests/

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

testtrain_pytest_allure-1.0.0b30.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

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

testtrain_pytest_allure-1.0.0b30-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file testtrain_pytest_allure-1.0.0b30.tar.gz.

File metadata

File hashes

Hashes for testtrain_pytest_allure-1.0.0b30.tar.gz
Algorithm Hash digest
SHA256 b3f210451d88d254bfe991e762cba676ff0e8a08cfa6ccb6b34a8866be8b56c8
MD5 90b6fc0dea71dc48eb7899d3fecec73c
BLAKE2b-256 47a0053e3a9bf1c7f47cb89e75b19d8e839103f6b47b9705895d8aa67e437ac9

See more details on using hashes here.

Provenance

The following attestation bundles were made for testtrain_pytest_allure-1.0.0b30.tar.gz:

Publisher: pypi-publish.yml on njxqlus/testtrain

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

File details

Details for the file testtrain_pytest_allure-1.0.0b30-py3-none-any.whl.

File metadata

File hashes

Hashes for testtrain_pytest_allure-1.0.0b30-py3-none-any.whl
Algorithm Hash digest
SHA256 61d0be98d8ee74557c3dd47986c5bce59a6c54070452db857f81c264d4b5e032
MD5 ed95f2e64bb1480f56d7661a172ba73b
BLAKE2b-256 87f0e117d5e4db0813dc48ca0ae5ae1f5e7ab9d2756d43f61a431c3c0c17edbe

See more details on using hashes here.

Provenance

The following attestation bundles were made for testtrain_pytest_allure-1.0.0b30-py3-none-any.whl:

Publisher: pypi-publish.yml on njxqlus/testtrain

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