Skip to content

Commit 28b627b

Browse files
committed
[GR-24571] Try to fix python3-unittests-gate
PullRequest: graalpython/1092
2 parents bf8f474 + 18f6f05 commit 28b627b

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

graalpython/com.oracle.graal.python.test/src/python_unittests.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def _run_cmd(cmd, timeout=TIMEOUT, capture_on_failure=True):
166166
log("[EXEC] finished '{}' with exit code {} in {:.3f}s", cmd_string, proc.returncode, delta)
167167
msg = "Finished: {:.3f}s".format(delta)
168168

169-
return proc.returncode == 0, output.decode("utf-8", "ignore") + "\n" + msg
169+
return proc.returncode == 0, output.decode("utf-8", "ignore"), msg
170170

171171

172172
def scp(results_file_path, destination_path, destination_name=None):
@@ -181,11 +181,13 @@ def _run_unittest(test_path, timeout, with_cpython=False):
181181
cmd = ["python3", test_path, "-v"]
182182
else:
183183
cmd = ["mx", "python3", "--python.CatchAllExceptions=true", test_path, "-v"]
184-
output = _run_cmd(cmd, timeout)[1]
184+
_, output, msg = _run_cmd(cmd, timeout)
185185
output = '''
186186
##############################################################
187-
#### running: {}
188-
'''.format(test_path) + output
187+
#### running: {}
188+
{}
189+
{}
190+
'''.format(test_path, output, msg)
189191
return output
190192

191193

@@ -236,8 +238,8 @@ def get_remote_host(scp_path):
236238

237239
def ssh_ls(scp_path):
238240
user, host, path = get_remote_host(scp_path)
239-
cmd = ['ssh', '{}@{}'.format(user, host), 'ls', '-l', path]
240-
return map(lambda l: l.split()[-1], _run_cmd(cmd)[1].splitlines())
241+
cmd = ['ssh', '{}@{}'.format(user, host), 'ls', '-1', path]
242+
return [f for f in _run_cmd(cmd)[1].splitlines() if f]
241243

242244

243245
def read_csv(path):
@@ -979,7 +981,7 @@ def _fmt(t):
979981
if flags.gate and flags.regression_running_tests:
980982
log("[REGRESSION] detecting regression, acceptance threshold = {}%".format(
981983
flags.regression_running_tests * 100))
982-
csv_files = list(filter(lambda entry: True if PTRN_VALID_CSV_NAME.match(entry) else False, ssh_ls(flags.path)))
984+
csv_files = sorted(f for f in ssh_ls(flags.path) if PTRN_VALID_CSV_NAME.match(f))
983985
last_csv = csv_files[-1]
984986
# log('\n'.join(csv_files))
985987
# read the remote csv and extract stats

0 commit comments

Comments
 (0)