[PATCH 2 of 4 V2] run-tests: extract a `process_out_line` from the main function
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Sun Sep 8 04:15:00 EDT 2019
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1560530224 -3600
# Fri Jun 14 17:37:04 2019 +0100
# Node ID 57aae8acdd093f2653922cf0a809dd861b759a59
# Parent 0c5eff3f149ed6a041511538ac6c04826ac0d29c
# EXP-Topic test-match
# Available At https://bitbucket.org/octobus/mercurial-devel/
# hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 57aae8acdd09
run-tests: extract a `process_out_line` from the main function
The main function doing line comparison is quite complex. Slicing it in smaller
piece should clarify it.
To avoid a huge diff, the code is kept at the same indentation. We'll re-indent
in the next changesets.
(This is a gratuitous cleanup that I made while investigating a bug).
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1616,6 +1616,24 @@ class TTest(Test):
if salt in out_rawline:
out_line, cmd_line = out_rawline.split(salt, 1)
+ pos, postout, warnonly = self._process_out_line(out_line,
+ pos,
+ postout,
+ expected,
+ warnonly)
+ pos, postout = self._process_cmd_line(cmd_line, pos, postout,
+ after)
+
+ if pos in after:
+ postout += after.pop(pos)
+
+ if warnonly == WARN_YES:
+ exitcode = False # Set exitcode to warned.
+
+ return exitcode, postout
+
+ def _process_out_line(self, out_line, pos, postout, expected, warnonly):
+ if True:
while out_line:
if not out_line.endswith(b'\n'):
out_line += b' (no-eol)\n'
@@ -1694,16 +1712,7 @@ class TTest(Test):
else:
continue
postout.append(b' ' + el)
-
- pos, postout = self._process_cmd_line(cmd_line, pos, postout, after)
-
- if pos in after:
- postout += after.pop(pos)
-
- if warnonly == WARN_YES:
- exitcode = False # Set exitcode to warned.
-
- return exitcode, postout
+ return pos, postout, warnonly
def _process_cmd_line(self, cmd_line, pos, postout, after):
"""process a "command" part of a line from unified test output"""
More information about the Mercurial-devel
mailing list