Skip to main content

chumicro-test-harness

A small cross-runtime test runner for ChuMicro libraries. It complements host-side pytest rather than replacing it, and it installs automatically through the [test] extra of any chumicro library (pip install chumicro-mqtt[test]).

What it provides

Module What it exports
chumicro_test_harness.runner run_module(module, name_filter=None)
chumicro_test_harness.discovery discover_source_roots, setup_source_paths, run_one_file
chumicro_test_harness.assertions raises (pytest-shaped context manager)
chumicro_test_harness.skip skip(reason)

Top-level re-exports: from chumicro_test_harness import raises, skip, run_module, run_one_file.

The harness powers cross-runtime unit tests. A library's tests/test_*.py files (excluding *_pytest.py) execute under MicroPython unix-port, CircuitPython unix-port, and CPython through normal pytest collection. Test files stay import pytest-free so the same sources run unchanged on every runtime.

How tests reach the harness

The pytest plugin chumicro-pytest-device owns discovery and orchestration. Two activation paths:

  • pytest <library>/tests --target unix-port --runtime micropython: the plugin spawns one <micropython-binary> run_cross_runtime.py --worker <test_file> subprocess per file. The worker exec()s the file as a module, calls run_module, and prints PASS / FAIL / SKIP / HEAP / SUMMARY lines back to the host.
  • pytest <library>/functional_tests/: the plugin routes through the chumicro-deploy transport instead, staging source onto a real board and running it there.

The chumicro workspace ships CLI wrappers that resolve the unix-port binary (workspace-prepared .tools/ build first, then PATH), auto-build it on first use, and delegate to the pytest invocation above. Pass --micropython-binary <path> / --circuitpython-binary <path> to override.

Device testing on real boards

Real-board execution goes through chumicro-pytest-device, the pytest plugin that stages source onto a board and runs functional_tests/ in the device runtime. IDE play buttons for functional_tests/ files use the same plugin.

The test harness shapes the on-device test environment (the chumicro_test_harness.skip() primitive, __chumicro_features__ markers, the assertions.raises helper) so the same test sources work both under unix-port harness runs and under on-device runs.

Skipping tests loudly

Use chumicro_test_harness.skip(reason) when a runtime feature isn't present (e.g. UDP on a runtime that lacks it). Bare if cond: return is a silent skip: it reads as PASS and hides broken tests. The harness's skip() raises a sentinel exception the runner classifies as SKIP with the given reason, so missing features stay visible.

Metadata

Release files for chumicro-test-harness-experimental 0.3.4

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

Source distribution (sdist)

Source distribution for chumicro-test-harness-experimental 0.3.4
File Size Uploaded
chumicro_test_harness_experimental-0.3.4.tar.gz 29.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chumicro-test-harness-experimental 0.3.4
File Interpreter ABI Platform
chumicro_test_harness_experimental-0.3.4-py3-none-any.whl Python 3 none any Details

Total release size: 50.7 kB

Release files / chumicro_test_harness_experimental-0.3.4.tar.gz

Download URL chumicro_test_harness_experimental-0.3.4.tar.gz
Size 29.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c1e0478417d8788ee39250e1be8c545ae5242c6e3c047862840169530fef2def
BLAKE2b-256 checksum
How to use checksums
3d40922e087d821cbf0d60025887831f7d7a8830c30b472df38981fb17afd17e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 9, 2026.

Transparency log

Release files / chumicro_test_harness_experimental-0.3.4-py3-none-any.whl

Download URL chumicro_test_harness_experimental-0.3.4-py3-none-any.whl
Size 20.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e605b3a2357c5085640ac4549baca19be0ec4d817cb2daab0ba24acf5d01b820
BLAKE2b-256 checksum
How to use checksums
dc85a55489ac486b0efa8664075218db83bad5942a610dcfdcd33bb2565d9be7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 9, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.4 This release

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

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