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.

Download files

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

Source Distribution

pytest_hwcontract-0.1.2.tar.gz (4.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_hwcontract-0.1.2-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file pytest_hwcontract-0.1.2.tar.gz.

File metadata

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

File hashes

Hashes for pytest_hwcontract-0.1.2.tar.gz
Algorithm Hash digest
SHA256 072478aec88b346f137026c2cc9751dcb80a89e2fbe7f932c17ae80b1faae181
MD5 eb75c6d0566b06bc08b0ccb13ef8b36e
BLAKE2b-256 e1cc963c3090dd6d16a23e153fa0a07df0f71b06ab978aefcaf48b3f91fcdb7b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_hwcontract-0.1.2.tar.gz:

Publisher: plugin.yml on MohibShaikh/hwcontract

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_hwcontract-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_hwcontract-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7f5e6b0d74356e0b0a07e558b53601b46e09e892a77eb96acfadf2db2a00a271
MD5 132b4f08af75dc47dd5b656ebe1d2892
BLAKE2b-256 7df7091ff7ca698be9a8174c356446dc767463b0163df2de870d95969f0cf5b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_hwcontract-0.1.2-py3-none-any.whl:

Publisher: plugin.yml on MohibShaikh/hwcontract

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.1.2 This release

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page