Skip to main content

test-protocol

CI PyPI Python License

Turn the raw results of a production or repair test into a printable test protocol for one device: serial number, measured values against their limits, a clear PASS/FAIL verdict with the failed checks on top, the input files with their SHA-256 for traceability, and signature boxes. Output is a single self-contained HTML file (A4 print layout), a PDF, or normalized JSON. Several result files of the same unit — the bench test, the interface test, the boot log comparison, a pytest run — are merged into one protocol.

Test protocol of a failed unit

$ test-protocol examples/EPC-24-00142/* --limits examples/limits.toml
EPC-24-00142: FAIL
PASS 43  FAIL 7
  FAIL  Storage / Reallocated sectors: 312 (≤ 10)
  FAIL  Storage / Pending sectors: 24 (≤ 0)
  FAIL  boot-log-diff.facts / dram: 2 GiB -> 1 GiB
  FAIL  boot-log-diff.facts / memory: 2097152K -> 1048576K
  FAIL  boot-log-diff.lines / log lines: 8 missing, 8 new
  FAIL  boot-log-diff.faults / mmc-timeout: eMMC/SD card does not respond (timeout)
  FAIL  boot-log-diff.faults / eth-phy: Ethernet PHY not found

$ test-protocol examples/EPC-24-00142/* --limits examples/limits.toml \
    --product "EPC-24 variant B" --operator "J. Doe" --meta order=PO-2026-118 \
    -o protocol.html --pdf protocol.pdf

Install

pip install test-protocol          # HTML and JSON, no dependencies
pip install "test-protocol[pdf]"   # adds WeasyPrint for PDF output

Python 3.10 or newer. For PDF output you need either WeasyPrint (the pdf extra; on Windows it needs the GTK/Pango libraries, see the WeasyPrint docs) or Chrome, Chromium or Edge, which the tool finds on its own.

Inputs

The format is detected from the file; --format forces it.

Input What becomes of it
bench-automation result.json every step with its measurements and limits; console log and instruments as attachments
interface-test-kit result.json every step with the measurements of the last attempt, "passed after retry", RMA number, profile, operator
JUnit XML (pytest --junitxml, boot-log-diff --junit, most CI tools) one step per test class, one check per test case; failure text as attachment
CSV with one measurement per row columns serial, step, measurement, value, unit, low, high, result (only measurement and value are required); German Excel exports with ; and decimal comma work
test-protocol JSON (--json) read back unchanged

A measurement is PASS or FAIL against its limits; one without limits and without a result is shown as INFO and does not count. Inputs of one protocol must have the same serial number — if they differ, the tool stops (exit 2). A file without a serial number (JUnit, CSV) takes it from the other inputs or from --serial.

Limits file

Limits from a TOML file replace the limits in the raw data, and PASS/FAIL is evaluated again. The protocol marks such limits with the file name, and the file is listed with its SHA-256.

[[limit]]
step = "Supply rails"     # optional: only in this step
measurement = "5V0"       # matched without regard to case
low = 4.9
high = 5.1
unit = "V"

[[limit]]
measurement = "BIOS version"
expect = "5.27"           # text comparison

A limit that matches no measurement gives a warning. --require-limits fails every measurement that has no limit at all — for a strict end-of-line test.

Options

Option
-o, --html FILE / --pdf FILE / --json FILE outputs; without any of them a summary goes to the terminal
--limits FILE, --require-limits see above
--serial, --product, --station, --operator header fields; they win over the inputs (the serial number must still match)
--meta KEY=VALUE extra header field, e.g. order or customer (repeatable)
--title, --company, --logo FILE protocol title, company name and logo (PNG, JPEG, SVG; embedded)
--approver second signature box "Approved by"
--lang en|de protocol in English or German (Prüfprotokoll, decimal comma)
--pdf-engine auto|weasyprint|chrome auto takes WeasyPrint if installed, else the browser; TEST_PROTOCOL_BROWSER points to a browser binary

Exit status: 0 PASS, 1 FAIL, 2 bad input or configuration — so a test station script or a CI job can use the verdict directly.

The examples

examples/ has two units of a simulated embedded PC: one that passes and one with a failing SSD and a broken boot. See examples/README.md.

Licence

MIT

Metadata

Release files for test-protocol 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for test-protocol 0.1.0
File Size Uploaded Provenance Actions
test_protocol-0.1.0.tar.gz 34.7 kB With provenance Details for test_protocol-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for test-protocol 0.1.0
File Interpreter ABI Platform Actions
test_protocol-0.1.0-py3-none-any.whl Python 3 none any Details for test_protocol-0.1.0-py3-none-any.whl

Total release size: 61.5 kB

Release files / test_protocol-0.1.0.tar.gz

Download URL test_protocol-0.1.0.tar.gz
Size 34.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f93ba5f126b41acc8abb77aa4039cece5f4f16db657343a76f511ef7f23e18b4
BLAKE2b-256 checksum
How to use checksums
13f10943cb07195b1a3fe46f867cbbf1ce56b9f22dd92303a6c8383cc016c3e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 29, 2026.

Transparency log

Release files / test_protocol-0.1.0-py3-none-any.whl

Download URL test_protocol-0.1.0-py3-none-any.whl
Size 26.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a3e8327caf4ededd9a756064d5c5df40c658d4f644c5002ae0094b69aea70e4
BLAKE2b-256 checksum
How to use checksums
7d8badb70ccaa4a7477e3df9485b325628effc203b841c9ca65733b98194fd9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 29, 2026.

Transparency log

Security for test-protocol 0.1.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for test_protocol-0.1.0.tar.gz

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 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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