summaryrefslogtreecommitdiff
path: root/tests/run-tests.py
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2025-05-26 10:41:33 +1000
committerDamien George <damien@micropython.org>2025-06-05 15:18:30 +1000
commit5b340b12b8ac8498838e0df73ff491bc2d105b46 (patch)
tree93f3ae7c78ec767f51e0ed34895f41b522601e86 /tests/run-tests.py
parent229104558fb7f9d283b7302bc3720bc35c5c49cf (diff)
tests/run-tests.py: Remove filename arg from prepare_script_for_target.
It's no longer used. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests/run-tests.py')
-rwxr-xr-xtests/run-tests.py20
1 files changed, 7 insertions, 13 deletions
diff --git a/tests/run-tests.py b/tests/run-tests.py
index c012dc96f..cb7a8b770 100755
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -269,22 +269,17 @@ def detect_test_platform(pyb, args):
print()
-def prepare_script_for_target(args, *, script_filename=None, script_text=None, force_plain=False):
+def prepare_script_for_target(args, *, script_text=None, force_plain=False):
if force_plain or (not args.via_mpy and args.emit == "bytecode"):
- if script_filename is not None:
- with open(script_filename, "rb") as f:
- script_text = f.read()
+ # A plain test to run as-is, no processing needed.
+ pass
elif args.via_mpy:
tempname = tempfile.mktemp(dir="")
mpy_filename = tempname + ".mpy"
- if script_filename is None:
- script_filename = tempname + ".py"
- cleanup_script_filename = True
- with open(script_filename, "wb") as f:
- f.write(script_text)
- else:
- cleanup_script_filename = False
+ script_filename = tempname + ".py"
+ with open(script_filename, "wb") as f:
+ f.write(script_text)
try:
subprocess.check_output(
@@ -300,8 +295,7 @@ def prepare_script_for_target(args, *, script_filename=None, script_text=None, f
script_text = b"__buf=" + bytes(repr(f.read()), "ascii") + b"\n"
rm_f(mpy_filename)
- if cleanup_script_filename:
- rm_f(script_filename)
+ rm_f(script_filename)
script_text += bytes(injected_import_hook_code, "ascii")
else: