Mercurial > hg
changeset 42898:fc8072f38fd6
run-tests: extract a `process_cmd_line` from the main function
The main function doing line comparison is quite complex. Slicing it in smaller
piece should clarify it.
(This is a gratuitous cleanup that I made while investigating a bug).
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 08 Sep 2019 10:08:41 +0200 |
parents | d7304434390f |
children | f461b65866e9 |
files | tests/run-tests.py |
diffstat | 1 files changed, 14 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/run-tests.py Sun Sep 08 09:42:53 2019 +0200 +++ b/tests/run-tests.py Sun Sep 08 10:08:41 2019 +0200 @@ -1695,15 +1695,7 @@ continue postout.append(b' ' + el) - if cmd_line: - # Add on last return code. - ret = int(cmd_line.split()[1]) - if ret != 0: - postout.append(b' [%d]\n' % ret) - if pos in after: - # Merge in non-active test bits. - postout += after.pop(pos) - pos = int(cmd_line.split()[0]) + pos, postout = self._process_cmd_line(cmd_line, pos, postout, after) if pos in after: postout += after.pop(pos) @@ -1713,6 +1705,19 @@ return exitcode, postout + def _process_cmd_line(self, cmd_line, pos, postout, after): + """process a "command" part of a line from unified test output""" + if cmd_line: + # Add on last return code. + ret = int(cmd_line.split()[1]) + if ret != 0: + postout.append(b' [%d]\n' % ret) + if pos in after: + # Merge in non-active test bits. + postout += after.pop(pos) + pos = int(cmd_line.split()[0]) + return pos, postout + @staticmethod def rematch(el, l): try: