Skip to content

tests/run-tests.py: Run tests-with-regex-output as normal tests. #17768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

dpgeorge
Copy link
Member

Summary

Some tests (currently given by the special_tests list) have output which must be mached via a regex, because it can change from run to run (eg the address of an object is printed). These tests are currently classified as is_special in the test runner, which means they get special treatment. In particular they don't set the emitter as specified by args.emit. That means these tests do not run via .mpy or using the native emitter, even if those options are given on the command line.

This commit fixes that by considering is_special as different to tests_with_regex_output. The former is used for things like target feature detection (which are not really tests) and when extra command line options need to be passed to the unix micropython executable. The latter (now called tests_with_regex_output) are specifically for tests that have output to be matched via regex.

The thread_exc2.py test now needs to be excluded when running using the native emitter, because the native emitter doesn't print traceback info.

Testing

Tested locally using the unix port. Will be more thoroughly tested by CI.

@dpgeorge dpgeorge added the tests Relates to tests/ directory in source label Jul 26, 2025
@dpgeorge dpgeorge force-pushed the tests-run-tests-regex-output-not-special branch from 0e6611f to bd3b157 Compare July 26, 2025 10:22
Copy link

codecov bot commented Jul 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.38%. Comparing base (c35427c) to head (1401fdb).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #17768   +/-   ##
=======================================
  Coverage   98.38%   98.38%           
=======================================
  Files         171      171           
  Lines       22283    22283           
=======================================
  Hits        21924    21924           
  Misses        359      359           

☔ View full report in Codecov by Sentry.
📢 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.

Some tests (currently given by the `special_tests` list) have output which
must be mached via a regex, because it can change from run to run (eg the
address of an object is printed).  These tests are currently classified as
`is_special` in the test runner, which means they get special treatment.
In particular they don't set the emitter as specified by `args.emit`.  That
means these tests do not run via .mpy or using the native emitter, even if
those options are given on the command line.

This commit fixes that by considering `is_special` as different to
`tests_with_regex_output`.  The former is used for things like target
feature detection (which are not really tests) and when extra command line
options need to be passed to the unix micropython executable.  The latter
(now called `tests_with_regex_output`) are specifically for tests that have
output to be matched via regex.

The `thread_exc2.py` test now needs to be excluded when running using the
native emitter, because the native emitter doesn't print traceback info.
And the `sys_settrace_cov.py` test needs to be excluded because set-trace
output is different with the native emitter.

Signed-off-by: Damien George <[email protected]>
@dpgeorge dpgeorge force-pushed the tests-run-tests-regex-output-not-special branch from bd3b157 to 1401fdb Compare August 10, 2025 01:42
@dpgeorge dpgeorge merged commit 1401fdb into micropython:master Aug 10, 2025
31 checks passed
@dpgeorge dpgeorge deleted the tests-run-tests-regex-output-not-special branch August 10, 2025 02:04
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.

1 participant