Skip to main content

Minimal cross-runtime test runner for ChuMicro libraries (workspace-internal).

Project description

chumicro-test-harness

A small cross-runtime test runner for ChuMicro libraries — internal to the mono-repo (not on PyPI), and meant to complement host-side pytest rather than replace it.

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. Files under libraries/*/tests/test_*.py (excluding *_pytest.py) execute under MicroPython unix-port and CircuitPython unix-port — and under 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 libraries/<name>/tests --target unix-port --runtime micropython — 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 libraries/<name>/functional_tests/ — 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 does not go through this package — it 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, hiding broken tests. The harness's skip() raises a sentinel exception the runner classifies as SKIP with the given reason, so missing features stay visible.

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

chumicro_test_harness_experimental-0.3.2.tar.gz (29.7 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file chumicro_test_harness_experimental-0.3.2.tar.gz.

File metadata

File hashes

Hashes for chumicro_test_harness_experimental-0.3.2.tar.gz
Algorithm Hash digest
SHA256 84ab8011fbe156ca010431643a451c463f46fcb78d6517895084440abbe0f024
MD5 56ce6085c7f12b7a11cfb84dc58a9646
BLAKE2b-256 62f3499e3b7f9f0f3e5985d589e6072e587afe8f008389a3b3de0ccb9d567aca

See more details on using hashes here.

Provenance

The following attestation bundles were made for chumicro_test_harness_experimental-0.3.2.tar.gz:

Publisher: release.yml on ChuMicro/ChuMicro

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

File details

Details for the file chumicro_test_harness_experimental-0.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for chumicro_test_harness_experimental-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0033a560faab656a06e38627b3f7a92f95ab42bb8182f6086848c0decdd60d9c
MD5 8a118a2f33794f71d05f0931af6444c3
BLAKE2b-256 6b2cfa01ac5c24ec655bb0cb772961fc534e2ca097adb31ef273acedfdf16b35

See more details on using hashes here.

Provenance

The following attestation bundles were made for chumicro_test_harness_experimental-0.3.2-py3-none-any.whl:

Publisher: release.yml on ChuMicro/ChuMicro

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