Skip to main content

pytest-testpulse

A pytest plugin that reports test results into TestPulse via its JUnit-XML import API, matching each test to an existing case by key.

Install

pip install pytest-testpulse

Usage

Mark a test with the case key it corresponds to in TestPulse:

import pytest

@pytest.mark.testpulse("LOGIN-42", platform="linux", tags=["smoke"])
def test_login_succeeds():
    ...

Run with --junitxml — the plugin reads pytest's own JUnit XML output rather than generating it itself, so this flag is required whenever the marker (or --testpulse-dry-run) is in use:

pytest --junitxml=report.xml

At the end of the session, the plugin submits report.xml to POST /api/v1/projects/{project}/imports and prints a summary. A suite with no marked tests and no --testpulse-dry-run needs no configuration at all — the plugin does nothing.

Configuration

Each setting resolves in this order: CLI flag › environment variable › pytest.ini/pyproject.toml option — the first one present wins.

Setting CLI flag Env var ini-option
API base URL --testpulse-url TESTPULSE_URL testpulse_url
API token --testpulse-token TESTPULSE_TOKEN testpulse_token
Project key --testpulse-project TESTPULSE_PROJECT testpulse_project
Fail on unmatched --testpulse-fail-on-unmatched / --testpulse-no-fail-on-unmatched TESTPULSE_FAIL_ON_UNMATCHED testpulse_fail_on_unmatched

TESTPULSE_URL/TESTPULSE_TOKEN match the env var names TestPulse's own docs already use for the raw conftest.py snippet, so migrating from that snippet to this plugin doesn't require renaming CI secrets. Put your token in an env var or CI secret — not in a committed ini-option.

testpulse_fail_on_unmatched (env var and ini-option) accepts 1/true/yes (case-insensitive) as true; anything else, including unset, is false. --testpulse-no-fail-on-unmatched overrides an ini-option or env var set to true, for a single local run.

Exit-code behavior

Import response Effect on pytest's exit code
201 — every test matched Untouched; a summary is printed to stderr.
207 — some tests unmatched Untouched by default (a warning is printed, naming the unmatched case keys and --testpulse-fail-on-unmatched as the escalation path). Set --testpulse-fail-on-unmatched to make this a hard failure instead.
Network error, auth failure, non-2xx Always fails the session — this isn't suppressible, since a broken submission is a different problem than an incomplete case-annotation rollout.

Dry run

--testpulse-dry-run previews which annotated case keys would match, via a read-only fetch of the project's cases — it never calls the import endpoint, never creates a run, and never affects the exit code:

pytest --junitxml=report.xml --testpulse-dry-run

Attachments

Call the testpulse_attach fixture from inside a marked test to attach a screenshot or file to its case:

@pytest.mark.testpulse("LOGIN-42")
def test_login_succeeds(testpulse_attach):
    ...
    testpulse_attach("failure.png")

Calling it on a test with no @pytest.mark.testpulse marker drops the attachment with a warning — there's no case key to attach it to. If a marked test's case comes back unmatched in a 207 response, its attachment is named separately in the warning output, distinct from the plain unmatched-case listing.

License

MIT

Download files

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

Source Distribution

pytest_testpulse-1.0.0.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

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

pytest_testpulse-1.0.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file pytest_testpulse-1.0.0.tar.gz.

File metadata

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

File hashes

Hashes for pytest_testpulse-1.0.0.tar.gz
Algorithm Hash digest
SHA256 1b387adda2e8c00109ea98cb3bfa7da3c7913e7e1c8bbdc25377c41d74b4e6a6
MD5 8e4b865e494ece0e0a499cf9bbc0a845
BLAKE2b-256 e4eefe8817bb70c2f697b068186e19ec1263a93f819276d3cb7421a9ae71dbc7

See more details on using hashes here.

Provenance

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

Publisher: release.yml on Barayo/pytest-testpulse

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

File details

Details for the file pytest_testpulse-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_testpulse-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e0f0d59b5cd6f5a91d60267c9499202c9ee039c175ade7073faaf7e80a01a2f0
MD5 ba2dcf89d8b754f3f74b2e04b76b3b85
BLAKE2b-256 f5dceb607be9d167aec951325bd82759a6fcbce4d83352476b39fb1645e61194

See more details on using hashes here.

Provenance

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

Publisher: release.yml on Barayo/pytest-testpulse

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

Release history Release notifications | RSS feed

1.0.1

2 files

This release

1.0.0 This release

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