Skip to content

Commit a84c2de

Browse files
committed
Fix TCK test report on Windows
1 parent 8e0f52b commit a84c2de

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

mx.graalpython/mx_graalpython.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,9 +1219,18 @@ def graalpython_gate_runner(args, tasks):
12191219
finally:
12201220
jdk.java_args_pfx = prev
12211221
if report():
1222-
with tempfile.NamedTemporaryFile(delete=True, suffix='.json.gz') as tmpfile:
1222+
tmpfile = tempfile.NamedTemporaryFile(delete=False, suffix='.json.gz')
1223+
try:
1224+
# Cannot use context manager because windows doesn't allow
1225+
# make_test_report to read the file while it is open for
1226+
# writing
12231227
mx.command_function('tck')([f'--json-results={tmpfile.name}'])
12241228
mx_gate.make_test_report(tmpfile.name, GraalPythonTags.junit + "-TCK")
1229+
finally:
1230+
try:
1231+
os.unlink(tmpfile.name)
1232+
except:
1233+
pass # Sometimes this fails on windows
12251234
else:
12261235
mx.command_function('tck')()
12271236

0 commit comments

Comments
 (0)