Skip to main content

pytest-hwcontract

Judge hardware captures against hwcontract contracts as ordinary pytest tests. A FAIL, MARGINAL or MISSING edge is a failing test with the rendered verdict table in the message, so JUnit and CI show exactly which edge failed, the measured value, and the delta.

pip install pytest-hwcontract

Use

def test_strip(hwcontract):
    obs = hwcontract.capture_csv("captures/strip.csv", samplerate=24_000_000)
    hwcontract.timing("ws2812b", obs)          # bundled contract by name
    hwcontract.timing("contracts/esc.contract.yaml", obs)   # or a path

def test_boot(hwcontract):
    hwcontract.serial("boot", open("boot.log").read())

Contracts resolve as: an existing path, then --hwcontract-root <dir>, then the 28 contracts bundled with hwcontract by name.

A failing verdict reads like the CLI's:

Failed: hwcontract verdict FAIL (4f2b9c1a0e7d)
edge        typ   actual  status    hint
------------------------------------------------------------
T1L         450   583     MARGINAL  only 17ns from max; nudge toward typ 450

Why marginal fails

In spec but rail-hugging works on your bench and dies in the field. The judge fails the test on MARGINAL by design; that is the whole point of gating CI on wire-level measurements.

Metadata

Release files for pytest-hwcontract 0.1.2

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-hwcontract 0.1.2
File Size Uploaded
pytest_hwcontract-0.1.2.tar.gz 4.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-hwcontract 0.1.2
File Interpreter ABI Platform
pytest_hwcontract-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 9.2 kB

Release files / pytest_hwcontract-0.1.2.tar.gz

Download URL pytest_hwcontract-0.1.2.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
072478aec88b346f137026c2cc9751dcb80a89e2fbe7f932c17ae80b1faae181
BLAKE2b-256 checksum
How to use checksums
e1cc963c3090dd6d16a23e153fa0a07df0f71b06ab978aefcaf48b3f91fcdb7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.

Transparency log

Release files / pytest_hwcontract-0.1.2-py3-none-any.whl

Download URL pytest_hwcontract-0.1.2-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f5e6b0d74356e0b0a07e558b53601b46e09e892a77eb96acfadf2db2a00a271
BLAKE2b-256 checksum
How to use checksums
7df7091ff7ca698be9a8174c356446dc767463b0163df2de870d95969f0cf5b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release 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