Skip to main content

Choreo — a declarative async test harness for message-driven systems

Project description

choreo — Choreo test harness library

An async Python test framework for message-driven systems. Write tests that declare "when I publish X, I expect Y" and the harness handles routing, correlation, timing, and reporting.

The library is transport-agnostic. Plug in a transport — MockTransport for unit tests, NatsTransport / KafkaTransport / RabbitTransport / RedisTransport for end-to-end, or your own — and the same scenario DSL works against all of them.

  • Python 3.11+
  • No runtime dependencies; pytest, pytest-asyncio, and pyyaml are test extras only.
  • Transport client libraries ship as optional extras (pip install 'choreo[nats]', choreo[kafka], choreo[rabbitmq], choreo[redis]).

Install

pip install choreo               # library only
pip install 'choreo[nats]'         # + NATS client for the e2e suite
pip install 'choreo[nats,test]'    # + pytest + pytest-asyncio + pyyaml

Pair with the companion reporter plugin for HTML + JSON test output:

pip install choreo-reporter

Correlation policy

The library ships with three correlation profiles (ADR-0019):

from choreo import Harness, NoCorrelationPolicy, DictFieldPolicy, test_namespace

# Default — transparent passthrough. Payloads are unchanged; every live scope
# on a topic sees every message (broadcast fallback). Safe on dedicated or
# per-run infrastructure; unsafe on a shared broker.
Harness(transport)

# Opt in to per-scope isolation by stamping/reading a dict field.
Harness(transport, correlation=DictFieldPolicy(field="trace_id", prefix="run-abc-"))

# Opt in to the TEST- prefix posture (downstream ingress filters on `TEST-`).
Harness(transport, correlation=test_namespace())

Custom policies implement the CorrelationPolicy protocol (new_id, write, read, routes_by_correlation) and can stamp into any shape the consumer's schema requires — a dict field, a transport header, a tag-value-protocol tag, a protobuf field. See the ADR for the protocol contract and the trust-boundary rules.

Examples

Runnable example projects live in the repo's examples/ directory:

  • examples/01-hello-world/ — minimum useful test.
  • examples/02-request-reply/ — staging a fake upstream with on().publish().
  • examples/03-parallel-isolation/ — opting into a CorrelationPolicy.
pytest examples/01-hello-world/

Documentation

See the project README at https://github.com/clear-route/choreo for architecture, the Scenario DSL, matchers, transports, and the downstream-consumer fixture pattern.

Licence

Apache-2.0. See LICENSE.

Project details


Download files

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

Source Distribution

choreo_harness-0.1.0.tar.gz (125.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

choreo_harness-0.1.0-py3-none-any.whl (73.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: choreo_harness-0.1.0.tar.gz
  • Upload date:
  • Size: 125.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for choreo_harness-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c243e8a524fb088e67325beb36f8719e03b5366c680ffcd2502db803f7212c06
MD5 c2a99648c0b2eec10b90c785629c1bef
BLAKE2b-256 8d7c31ece7580c72384d9726804327dca438be8efd08673aaab791f880517f76

See more details on using hashes here.

Provenance

The following attestation bundles were made for choreo_harness-0.1.0.tar.gz:

Publisher: release.yml on clear-route/choreo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file choreo_harness-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: choreo_harness-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 73.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for choreo_harness-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09b68aae967ef6aaf1d40079c8124f21d446c9c671ddb42e6f1c3016caf64fdd
MD5 49581019471e0958bf65d34f8fafc788
BLAKE2b-256 fdd355bc92c9f6071c804328899c53a9583b3b8fc0849b2439bd5385ecc7b975

See more details on using hashes here.

Provenance

The following attestation bundles were made for choreo_harness-0.1.0-py3-none-any.whl:

Publisher: release.yml on clear-route/choreo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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