Python test framework for critical-software systems. Write, run, and trace system-level tests against any System Under Test (SUT).
Project description
Python test framework for critical-software systems. Write, run, and trace system-level tests against any System Under Test (SUT).
ammtest
ammtest is a Python test framework for testing critical-software systems. It connects to ammio to interact with the SUT — writing inputs, reading outputs, and asserting behavior — with full traceability built in.
It addresses three core pain points in critical systems testing:
- The evidence problem: Tests run, tests pass — but certification asks for proof. ammtest writes a structured, traceable result file on every execution, automatically. The test itself becomes the specification.
- The traceability gap: Requirements live in one document, tests live in another, and nobody can prove they match. ammtest binds them at the source — no spreadsheets, no manual cross-referencing.
- The infrastructure tax: Connecting to a real system takes more code than the test itself. ammtest handles the communication layer, so you write stimulus and assertions — nothing else.
Quickstart
Install
uv pip install ammtest
Write a test
from ammtest import ammtest, AmmioClient, AmmTestHelper
@ammtest(
version="0.1.0",
description="Check if brake engages on request",
requirements=[
{"req": "REQ-1416", "baseline": "A"},
{"req": "REQ-1418", "baseline": "B"},
],
)
def test(cl: AmmioClient, th: AmmTestHelper):
# Force SUT input via ammio
cl.write("brake_request", 1)
# Wait for the SUT to react (0.5s)
th.wait(0.5)
# Check status and log results (traced to REQ-1416/1418)
th.check("brake_status", lambda v: v == 1)
Run
ammtest run tests/TC_001.py --endpoint=tcp://127.0.0.1:5555
Note: requires ammio to be running.
Log
================================================================================
AMMTEST EXECUTION REPORT
================================================================================
Date: 2026-03-06
Time: 16:43:36
Executed by: jdoe
Host: my-machine
--------------------------------------------------------------------------------
File: TC_001.py
Test: TC_001::test
Version: 0.1.0
Description: Check if brake engages on request
Requirements: req: REQ-1416 baseline: [A]
req: REQ-1418 baseline: [B]
================================================================================
--- LOG ---
16:43:36.531 INFO WRITE: brake_request = 1
16:43:37.033 INFO CHECK PASS brake_status = 1 [v == 1]
================================================================================
--- RESULT ---
Status: PASS
Duration: 0.502s
================================================================================
Architecture
ammtest discovers @ammtest-decorated functions, runs each against a live ammio instance, and writes result files to disk. No test framework overhead — plain Python functions, plain files.
test functions (@ammtest decorator)
│
│ cl.write("var", value) → write SUT inputs
│ th.check("var", lambda v: v == 1) ← one-shot check, reading SUT outputs
│
┌──────┴───────────────────────────────────────────────────────┐
│ ammtest │
│ ┌──────────┐ ┌─────────────┐ ┌─────────────────────────┐ │
│ │ @ammtest │ │ AmmioClient │ │ AmmTestHelper │ │
│ │ metadata │ │ nng REQ/REP │ │ check / check_stable │ │
│ └──────────┘ └──────┬──────┘ │ check_until / check_at │ │
│ │ └─────────────────────────┘ │
│ runner: discover, run, write results │
└───────────────────────│──────────────────────────────────────┘
│ nng REQ/REP · JSON · TCP
▼
ammio → SUT
@ammtest decorator: Tags a function as a test case. Attaches version, description, and requirements as metadata directly on the function.
AmmioClient (cl): Connects to ammio over nng REQ/REP. write(var_id, value) forces SUT inputs; read(var_id) observes SUT outputs. Errors from ammio are resolved to human-readable names and raised as AmmioError.
AmmTestHelper (th): Injected as the second argument to each test function. Provides check methods and a wait helper — each check reads a variable, evaluates a lambda condition, and emits a CHECK PASS / CHECK FAIL log line with the variable name, actual value, and condition expression.
| Method | Semantics |
|---|---|
th.check(var, cond) |
Value satisfies condition right now |
th.check_stable(var, cond, duration) |
Condition holds for entire duration seconds |
th.check_until(var, cond, timeout) |
Condition becomes true within timeout seconds |
th.check_at(var, cond, at, tolerance) |
Condition first becomes true at at +- tolerance seconds |
th.wait(duration) |
Sleep for duration seconds, logging start and end |
Runner: Discovers all @ammtest functions under a path, runs each in sequence, writes one .txt result file per test. Result files include a full execution header (date, user, host, metadata), real-time log output, status, duration, and error details.
Traceability commands: Two static analysis commands operate on test files without connecting to ammio.
| Command | Output |
|---|---|
ammtest trace-tests <path> |
One row per test — which requirements it covers. Flags tests with no requirements. |
ammtest trace-reqs <path> --reqs=<csv> --col=<n> |
One row per requirement from the CSV — which tests cover it. Flags requirements with no test. |
trace-reqs options:
--col=<n>— 1-based column number where requirement IDs are--skip-header— skip the first row if the CSV has a header--delimiter="<char>"— column separator (default:,); quote special characters to avoid shell interpretation
ammtest trace-tests tests/
ammtest trace-reqs tests/ --reqs=requirements.csv --col=1 --skip-header
ammtest trace-reqs tests/ --reqs=requirements.csv --col=2 --skip-header --delimiter=";"
Related Projects
- ammio: Protocol agnostic test interface for critical-software systems. Talk to any System Under Test (SUT) in JSON, regardless of its protocol.
- Ammonit Software: Parent organization.
License
This project is open source and available under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ammtest-0.1.2.tar.gz.
File metadata
- Download URL: ammtest-0.1.2.tar.gz
- Upload date:
- Size: 588.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
105565c129d36330ff537d6099879c17869dff32a66343e6d4ae5d42c9bb9934
|
|
| MD5 |
3a1e78000b6e3c086999c7cb583a67a2
|
|
| BLAKE2b-256 |
55f42bdb0d7555abad90d8971c712cfea8e135de9771785c96e1abdb63a4c4ec
|
Provenance
The following attestation bundles were made for ammtest-0.1.2.tar.gz:
Publisher:
ci.yml on ammonit-software/ammtest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ammtest-0.1.2.tar.gz -
Subject digest:
105565c129d36330ff537d6099879c17869dff32a66343e6d4ae5d42c9bb9934 - Sigstore transparency entry: 1440152249
- Sigstore integration time:
-
Permalink:
ammonit-software/ammtest@663708f558d0ee9d29777732849dafbd50b05b0e -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/ammonit-software
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@663708f558d0ee9d29777732849dafbd50b05b0e -
Trigger Event:
push
-
Statement type:
File details
Details for the file ammtest-0.1.2-py3-none-any.whl.
File metadata
- Download URL: ammtest-0.1.2-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb50cf5c40271f79ae129be9a3f3168de0206bc0b20359033733e3defb5c7cce
|
|
| MD5 |
48641064af8cc7135f0b12a819c7da00
|
|
| BLAKE2b-256 |
ae2450215b013028cccac9e479719ab3d52c3eec02a3c615adb77991c6c7ba56
|
Provenance
The following attestation bundles were made for ammtest-0.1.2-py3-none-any.whl:
Publisher:
ci.yml on ammonit-software/ammtest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ammtest-0.1.2-py3-none-any.whl -
Subject digest:
cb50cf5c40271f79ae129be9a3f3168de0206bc0b20359033733e3defb5c7cce - Sigstore transparency entry: 1440152263
- Sigstore integration time:
-
Permalink:
ammonit-software/ammtest@663708f558d0ee9d29777732849dafbd50b05b0e -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/ammonit-software
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@663708f558d0ee9d29777732849dafbd50b05b0e -
Trigger Event:
push
-
Statement type: