Skip to main content

testivai (Python)

Local-first visual regression for playwright-python — pixel + DOM comparison with tunable tolerances, a self-contained HTML report, and PR-comment baseline approvals. Shares the exact on-disk contract with the JS/TS TestivAI adapters, so mixed-language repos use one set of baselines, one report, one approval flow.

pip install testivai[playwright]

With pytest (pytest-playwright)

def test_homepage(page, testivai_witness):
    page.goto("http://localhost:3000")
    testivai_witness(page, "homepage")

The bundled pytest plugin runs testivai report at session end: captures are diffed against .testivai/baselines/, tolerances from .testivai/config.json apply, and visual-report/index.html + results.json are written. Approve baselines with npx testivai approve --all (or a /testivai approve PR comment via the GitHub Action).

Without pytest

from testivai import witness, run_report

witness(page, "homepage", ignore_selectors=[".live-feed"], variant="firefox")
run_report()

What captures do (identical to the JS adapters)

  • Stabilization by default: animations/transitions complete instantly at their final state, caret hidden, web fonts awaited — the top causes of flaky visual diffs, neutralized.
  • ignore_selectors: hidden from the pixels and excluded from the DOM snapshot (dynamic content never counts as a change).
  • variant: folds into the snapshot name (homepage__firefox) so parallel browsers/viewports never overwrite each other's baselines.

The compare/report half runs via the @testivai/witness CLI — Node.js is already present wherever playwright-python is (Playwright for Python ships a Node driver). Resolution order: TESTIVAI_CLI env → testivai on PATH → npx --yes @testivai/witness.

Docs: https://github.com/testivai/testivai-oss/blob/main/docs/frameworks/python.md

MIT.

Download files

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

Source Distribution

testivai-0.2.0.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

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

testivai-0.2.0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file testivai-0.2.0.tar.gz.

File metadata

  • Download URL: testivai-0.2.0.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for testivai-0.2.0.tar.gz
Algorithm Hash digest
SHA256 60396ddb8823fbe7519b984bb15627f8e838fbe3ca313c75c8f4974b5e5a0603
MD5 a6907b225db07e98ed93e783282b4372
BLAKE2b-256 024abfb2fe23f0f0936b6047bdfb9f9874e7bfb293bb2fd8d3a7f1fc763ce70b

See more details on using hashes here.

Provenance

The following attestation bundles were made for testivai-0.2.0.tar.gz:

Publisher: release-python.yml on testivai/testivai-oss

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

File details

Details for the file testivai-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: testivai-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for testivai-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f4d9bfb46bcb0475ab3b943dcfde7dfdc4859f89290320923a72b75870fecb1
MD5 d81b794e7b6acbfdbabc3518f8b7fa3e
BLAKE2b-256 cf2c07fbea1af374bc08fb9e0105a2f5521058c48f6d326aa2b9c3fa8e85b456

See more details on using hashes here.

Provenance

The following attestation bundles were made for testivai-0.2.0-py3-none-any.whl:

Publisher: release-python.yml on testivai/testivai-oss

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

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.0

2 files

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