pytest-visionspec
Pytest plugin that auto-reports test results with screenshots to VisionSpec.
Install
pip install pytest-visionspec
Setup
Set two environment variables:
VS_API_KEY=vs_your_project_api_key
VS_API_URL=https://visionspec-dev.helpfulhuman.xyz
Usage
Tag tests with @pytest.mark.vs("journey-id"):
@pytest.mark.vs("login-happy-path")
def test_login(page):
page.goto("/login")
page.fill("[name=email]", "user@example.com")
page.click("button[type=submit]")
assert page.url == "/dashboard"
The plugin automatically:
- Captures a Playwright screenshot after each test
- Uploads it to VisionSpec storage
- Posts the result (pass/fail + screenshot URL) to VisionSpec
Markers
@pytest.mark.vs("journey-id")— link test to a VisionSpec V1 journey spec@pytest.mark.vs_surface("mobile")— override the reported surface (default:desktop)@pytest.mark.vs_v2("spec-slug", jtbd="jtbd-slug")— link test to a VisionSpec V2 spec (chapters model). Results are buffered and POSTed in one batch at session end to/api/v2/results.
V2 usage (chapters model)
For V2 projects, tag tests with vs_v2 — no screenshot capture, batched reporting:
@pytest.mark.vs_v2("verdict-returns-200", jtbd="get-verdict")
def test_verdict():
r = client.get("/verdict")
assert r.status_code == 200
Get your project's VS_API_KEY via the V2 MCP tool get_project(project) (returns test_reporting.env_vars) or from the "CI / Test runner" tab in V2 project settings.
Results POST once per pytest session. Coverage in V2 get_doc's summary field then shows tested / passing / failing counts per spec.
Git SHA auto-detection (V2)
Each vs_v2 result is tagged with the SUT's git SHA so the vs2
dashboard can group results by build ("which SHA is safe to ship?").
Detection is automatic and deterministic:
git rev-parse HEAD— works locally and in any CI that checks out the.gitdirectory (GitHub Actions does this by default).GITHUB_SHA— GH Actions sets this natively.- Omitted — if neither works, results are recorded without a revision tag. The dashboard's build-scoped views will not include them.
No user-configurable env var (like VS_GIT_SHA) is supported — the
git SHA is a single source of truth (the SUT itself). Setting it via
env var risks tagging results with the wrong SHA.
Page fixture detection
By default, the plugin looks for a page fixture. Configure custom fixture names in pyproject.toml:
[tool.pytest.ini_options]
vs_page_fixtures = ["v2app", "v1app", "page"]
The plugin checks each name in order and uses the first one it finds.
Environment variables
| Variable | Required | Description |
|---|---|---|
VS_API_KEY |
Yes | Project API key from VisionSpec |
VS_API_URL |
Yes | VisionSpec server URL |
VS_SUT_VERSION |
No | Version of the system under test |
VS_VERBOSE |
No | Set to 1 for debug logging |
VS_VERSION |
No | App version metadata |
VS_FRONTEND_VERSION |
No | Frontend version metadata |
VS_BACKEND_VERSION |
No | Backend version metadata |
Metadata
Release files for pytest-visionspec 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pytest_visionspec-0.4.0.tar.gz | 7.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_visionspec-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.4 kB
Release files / pytest_visionspec-0.4.0.tar.gz
| Download URL | pytest_visionspec-0.4.0.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2945a9fa22f0a8d5af01ea48c9df614e1087337457dfa8b2a9bd351c50d8434e
|
|
BLAKE2b-256 checksum How to use checksums |
6a47bf35f485d192b2ecef2a89e5bca143eb984735d4d7c73a9c0c4c0a616c4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Release files / pytest_visionspec-0.4.0-py3-none-any.whl
| Download URL | pytest_visionspec-0.4.0-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e4afe465dbcb0206ae0517ab076509d61dedadb61bacf7ee0d89e78780507a3a
|
|
BLAKE2b-256 checksum How to use checksums |
0e0abb058d6a9ec3efad7f5f68a28c75d868c6d0d1c69d50d26f52a5abeca032
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Security for pytest-visionspec 0.4.0
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.