mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-devtest
synced 2026-01-15 10:23:32 +01:00
test.ListCmd: Beautify fail output
Make fail return a multi-line experience, possibly breaking grep, so try out if this is a good idea. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
476f501fbe
commit
cf9dc2a392
1 changed files with 15 additions and 7 deletions
|
|
@ -355,17 +355,24 @@ class ListCmd(TestCase): # export
|
|||
slog_m(NOTICE, "--- ignored:\n", format_rows(ignored))
|
||||
|
||||
r = []
|
||||
sep = ', '
|
||||
line_break = ''
|
||||
and_str = ' and '
|
||||
if (len(missing) > 3 or len(too_many) > 3):
|
||||
sep = ',\n'
|
||||
line_break = '\n'
|
||||
and_str = '\n'
|
||||
if len(missing):
|
||||
slog_m(ERR, "--- should be there but are not:\n", format_rows(missing, quotes=True))
|
||||
r.append("missing:" + ', '.join([row.name for row in missing]))
|
||||
r.append("missing:" + line_break + sep.join([row.name for row in missing]))
|
||||
if len(too_many):
|
||||
slog_m(ERR, "--- too many:\n", format_rows(too_many, quotes=True))
|
||||
r.append("too many: " + ', '.join([row.name for row in too_many]))
|
||||
r.append(line_break + "too many: " + line_break + sep.join([row.name for row in too_many]))
|
||||
if not len(r):
|
||||
return None
|
||||
|
||||
feature_diff = set(features) - last_features
|
||||
if self.__write_response and len(feature_diff):
|
||||
if self.__write_response and (len(missing) or len(too_many)):
|
||||
feature_diff = set(features) - last_features # if len(feature_diff) ?
|
||||
response_path = self.refpath[0] + '.bad'
|
||||
if tstamp is not None:
|
||||
response_path += '-' + tstamp
|
||||
|
|
@ -377,12 +384,13 @@ class ListCmd(TestCase): # export
|
|||
if len(missing):
|
||||
f.write("# --- missing {}\n".format(feature_diff))
|
||||
for row in missing:
|
||||
f.write(row.line.strip() + ' # "needed": [{}], "bad": ["default"]\n'.format(feature_diff_str))
|
||||
f.write(row.line.strip() + ' # "bad": [{}]\n'.format(feature_diff_str))
|
||||
if len(too_many):
|
||||
f.write("# --- too many {}\n".format(feature_diff))
|
||||
for row in too_many:
|
||||
f.write(row.line.strip() + ' # "bad" [{}]\n'.format(feature_diff_str))
|
||||
return ' and '.join(r)
|
||||
f.write(row.line.strip() +
|
||||
' # "needed": [{}], "bad": ["default"]\n'.format(feature_diff_str))
|
||||
return and_str.join(r)
|
||||
|
||||
async def _run(self, env, machine, phase):
|
||||
console = get_console(env)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue