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.3

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.3
File Size Uploaded
pytest_hwcontract-0.1.3.tar.gz 5.4 kB Details

Built distribution (wheel)

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

Total release size: 9.7 kB

Release files / pytest_hwcontract-0.1.3.tar.gz

Download URL pytest_hwcontract-0.1.3.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3fb8a098f32544997fce07fa80271d05c9300e56281849b570b9df3a7eecd26b
BLAKE2b-256 checksum
How to use checksums
f1e19a27d11c98297ed3758d05c0cb09d5677cb1b7cc7a23688cbd4d9df9e507
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 Oct 15, 2026.

Transparency log

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

Download URL pytest_hwcontract-0.1.3-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3dab7f5b1b46c8a3fee8cef332d98911b7f69709eb72e662d6feaef3acbc1d3
BLAKE2b-256 checksum
How to use checksums
3b62fabe2316ba174fe9d4d150f10423326c674bfb6a98fefaa675cc65d37ee1
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 Oct 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

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