diff --git a/src/python/devtest/os/test/ListCmd.py b/src/python/devtest/os/test/ListCmd.py index 24e46d6..1aa9b70 100644 --- a/src/python/devtest/os/test/ListCmd.py +++ b/src/python/devtest/os/test/ListCmd.py @@ -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)