tests/run-tests: Remove any 'expected' file from a unittest run.

This won't be generated normally, but a failed run (for example, from a
unittest with an error or which doesn't call unittest.main()) will
generate one.

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 10:58:37 +11:00
parent 016ae19cf0
commit 5f01232dd7

View File

@@ -996,6 +996,8 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
if output_expected is not None:
with open(filename_expected, "wb") as f:
f.write(output_expected)
else:
rm_f(filename_expected) # in case left over from previous failed run
with open(filename_mupy, "wb") as f:
f.write(output_mupy)
failed_tests.append((test_name, test_file))