Skip to content

tests/run-tests.py: Add --trace-output option for board targets.#19329

Open
dpgeorge wants to merge 1 commit into
micropython:masterfrom
dpgeorge:tests-run-tests-add-trace-option
Open

tests/run-tests.py: Add --trace-output option for board targets.#19329
dpgeorge wants to merge 1 commit into
micropython:masterfrom
dpgeorge:tests-run-tests-add-trace-option

Conversation

@dpgeorge

Copy link
Copy Markdown
Member

Summary

This adds a new --trace-output option (short-hand -c) to run-tests.py which mimics the same option already in run-multitests.py. Using it, the output from the test running on a board is printed to stdout as it is received.

This allows easier debugging of tests, to see the output in real time. For tests that have complicated run parameters, eg using via-mpy or needing a target wiring script, running them standalone (eg with mpremote) is not possible, so using run-tests.py becomes mandatory, hence the need to easily see the output without having to view the result file separately at the end. It's also useful to watch tests that pass but are long running.

Testing

Tested on PYBD_SF6:

  • running normally, still works
  • running with -c, gives lots of output and everything still passes as before
  • deliberately making a test fail, the results file still has the full output, and the crash is also printed to stdout
  • deliberately making a test lock up the board, the test runner correctly stops after a few tests have failed to enter the raw repl

Generative AI

Not used.

@dpgeorge dpgeorge added the tests Relates to tests/ directory in source label Jun 10, 2026
This adds a new `--trace-output` option to `run-tests.py` which mimics the
same option already in `run-multitests.py`.  Using it, the output from the
test running on a board is printed to stdout as it is received.

This allows easier debugging of tests, to see the output in real time.  For
tests that have complicated run parameters, eg using via-mpy or needing a
target wiring script, running them standalone (eg with `mpremote`) is not
possible, so using `run-tests.py` becomes mandatory, hence the need to
easily see the output without having to view the result file separately at
the end.  It's also useful to watch tests that pass but are long running.

Signed-off-by: Damien George <damien@micropython.org>
@dpgeorge dpgeorge force-pushed the tests-run-tests-add-trace-option branch from 6690643 to 907027e Compare June 10, 2026 03:19
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.47%. Comparing base (1f50d05) to head (907027e).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #19329   +/-   ##
=======================================
  Coverage   98.47%   98.47%           
=======================================
  Files         176      176           
  Lines       22845    22845           
=======================================
  Hits        22497    22497           
  Misses        348      348           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@octoprobe-bot

Copy link
Copy Markdown

Octoprobe PR report

Test Tests
passed
Tests
skipped
Tests
xfailed
Tests
failed
Total
Failures

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Relates to tests/ directory in source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants