Skip to main content

Official Testinel plugin for pytest

Testinel’s pytest plugin captures structured Selenium and Playwright test execution data directly from pytest and sends it to Testinel, where your test results become searchable, comparable, and actually useful. No log scraping. No brittle CI hacks. Just deterministic test analytics.

📦 Getting Started

Prerequisites

You need a Testinel account and project.

Python 3.11 through 3.16 is required.

Installation

Getting Testinel into your project is straightforward. Just run this command in your terminal:

pip install --upgrade pytest-testinel

Or with uv:

uv add pytest-testinel

Configuration

Set Testinel reporter DSN environment variable TESTINEL_DSN. Get DSN for your project at https://testinel.dev/projects/.

Examples:

# Report to Testinel (HTTPS)
export TESTINEL_DSN="https://your.testinel.endpoint/ingest/xxxxxxxxxxxx/"
# Report to a local file (JSON)
export TESTINEL_DSN="file:///tmp/testinel-results.json"

# Or use a direct file path
export TESTINEL_DSN="./testinel-results.json"

Logging

Testinel uses pytest's standard logging controls.

Each reported event has a UUID event_id in its JSON body, including events written to a local file. Each HTTP event submission and upload-link request gets a fresh UUID request_id, sent in both the X-Request-ID header and the JSON body. Sending the same event again preserves its event_id and generates a new request_id. The IDs are logged at DEBUG before sending the request. Signed binary uploads retain the headers supplied by the storage provider.

If an event submission returns HTTP 404, Testinel disables reporting for the rest of the run and emits one terminal warning and one WARNING log record. Check TESTINEL_DSN and your project at https://testinel.dev/projects/. Tests continue normally with their usual exit status. No further events or new attachments are sent; queued uploads are discarded, while an upload already in progress may finish. A fresh pytest process tries reporting again. Other request failures, including attachment-link or storage-upload 404s, keep their existing best-effort behavior.

To set the logging level to INFO for all pytest loggers and show the messages live, run:

pytest --log-level=INFO --log-cli-level=INFO

To change the level for pytest-testinel only, set its parent logger in your project's conftest.py:

import logging


def pytest_configure() -> None:
    logging.getLogger("pytest_testinel").setLevel(logging.INFO)

To also show these messages live, enable pytest's live logging:

pytest -o log_cli=true

Other loggers keep their existing levels. Replace INFO with DEBUG, WARNING, or another standard Python logging level as needed.

Use pytest's --log-file, --log-format, and related options to control log storage and formatting.

For better debugging and richer failure context, it is highly recommended to run pytest with:

--showlocals --tb=long -vv

Why:

  • --showlocals: includes local variable values in tracebacks, which makes root-cause analysis much faster.
  • --tb=long: shows full, non-truncated tracebacks so you can see complete failure paths.
  • -vv: increases verbosity, showing more detailed test identifiers and execution output.

Example:

pytest --showlocals --tb=long -vv

If you run browser tests with pytest-playwright, these flags provide better artifacts for debugging:

--tracing=retain-on-failure --video=retain-on-failure --screenshot=only-on-failure --output=test-results

Why:

  • --tracing=retain-on-failure: captures a full Playwright trace for failed tests only.
  • --video=retain-on-failure: keeps video recordings only for failed tests.
  • --screenshot=only-on-failure: saves screenshots at failure time.
  • --output=test-results: stores artifacts in a predictable directory.

Example:

pytest --tracing=retain-on-failure --video=retain-on-failure --screenshot=only-on-failure --output=test-results

Development

Run the test matrix with tox:

uv run tox

The matrix covers Python 3.11 through 3.16 against the latest available release in each pytest major version: 7, 8, and 9. Each environment installs the package as a wheel. Missing Python interpreters fail the run; install them before running the full matrix.

Run one environment, or pass arguments to pytest:

uv run tox -e py311-pytest7
uv run tox -e py315-pytest9 -- tests/test_testinel.py -v

Use uv run tox run -r to recreate environments and resolve the latest pytest releases after new versions are published.

Bounded diagnostics (0.10.0)

Reports use configurable byte limits and visible truncation/omission markers. TESTINEL_MAX_EVENT_BYTES defaults to 786432 (minimum 16384), TESTINEL_MAX_VALUE_BYTES to 4096, and TESTINEL_MAX_FRAME_LOCALS_BYTES to 16384. The final check includes request IDs and the entire encoded JSON envelope. Compact v2 is negotiated with a capable server; older servers and file/custom backends receive bounded v1. Irreducible inventories disable reporting explicitly, without changing test execution or shortening identities. See the protocol, limits, deprecations, and offline format.

Metadata

Release files for pytest-testinel 0.11.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-testinel 0.11.1
File Size Uploaded Provenance Actions
pytest_testinel-0.11.1.tar.gz 21.3 kB Without provenance Details for pytest_testinel-0.11.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pytest-testinel 0.11.1
File Interpreter ABI Platform Actions
pytest_testinel-0.11.1-py3-none-any.whl Python 3 none any Details for pytest_testinel-0.11.1-py3-none-any.whl

Total release size: 46.4 kB

Release files / pytest_testinel-0.11.1.tar.gz

Download URL pytest_testinel-0.11.1.tar.gz
Size 21.3 kB
Tags Source
SHA-256 checksum
How to use checksums
5dbac07f39a98ebfd4743363ce5ce337d504fb4b423c8e1208b00bf14f156313
BLAKE2b-256 checksum
How to use checksums
b8c355eecfa49e5592cdf307ee760e4f63bdc148f609c0cac219e65c31576bcb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.3 {"installer":{"name":"uv","version":"0.13.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / pytest_testinel-0.11.1-py3-none-any.whl

Download URL pytest_testinel-0.11.1-py3-none-any.whl
Size 25.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
99a99c233b828c1b69e37aec29f09bdfbdbed57e35628a4223462f9834235ed9
BLAKE2b-256 checksum
How to use checksums
9fd4a5171bc86d04d9930c5ba0112d23f7b259a74cc80d42fc9d72e986172ecc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.3 {"installer":{"name":"uv","version":"0.13.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for pytest-testinel 0.11.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page