test/run-tests: Print a note if it looks like unittest.main() missing.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
This commit is contained in:
Angus Gratton
2025-02-26 11:00:53 +11:00
parent 5f01232dd7
commit b4cf82b2d6

View File

@@ -1004,6 +1004,16 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
test_count.increment()
# Print a note if this looks like it might have been a misfired unittest
if not uses_unittest and not test_passed:
with open(test_file, "r") as f:
if any(re.match("^import.+unittest", l) for l in f.readlines()):
print(
"NOTE: {} may be a unittest that doesn't run unittest.main()".format(
test_file
)
)
if pyb:
num_threads = 1