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.1.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.1-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytest_hwcontract-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 a81f6596022a1835289cdf12a540272630cbbcc71e90559b50cf8a2e8435eb52
MD5 83a35f89cec4a46f02842c692e27ad2d
BLAKE2b-256 32af4202f15d8addace509777a497c76b77fd5a8ba1b72819c1b9b48848468ca

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytest_hwcontract-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6b26c599588e1319e592a40e1d9971275e655fc846f90fb12abc8aa40c6e6f2b
MD5 331fb7d82c6495c2a11e5ec0f1fdd14e
BLAKE2b-256 0644bbce6f3f6f0551ed4c93ae71d08dac6acebfb3e3fae84190025167b8a6b1

See more details on using hashes here.

Provenance

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

This release

0.1.1 This release

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