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 27 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.0.tar.gz (3.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.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytest_hwcontract-0.1.0.tar.gz
  • Upload date:
  • Size: 3.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.0.tar.gz
Algorithm Hash digest
SHA256 203187c9397d86bc05330fcd1eaf8031a3b873c983f318eed23c36a32b4d506e
MD5 a240f6fffc895389ade47047bf21590d
BLAKE2b-256 c56a831c0889ffb2e4d8a44f8fc369d935a4e166b6102829b08f15a5d1b17ae1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_hwcontract-0.1.0.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.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_hwcontract-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9e517b13680a9b7c06b576013b8a1921d87614e752473c1b118393ac6a38fa77
MD5 15c7d69e21bfe5b4b151bb6b11c882ff
BLAKE2b-256 88d5e9e26ec8b67fc72b37297b41315fa1931890fc9271e3648328a042ab6c3f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_hwcontract-0.1.0-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

0.1.2

2 files

0.1.1

2 files

This release

0.1.0 This release

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