Mercurial > hg
view tests/filtertraceback.py @ 45407:de9ec12ee53c
run-tests: refactor filtering logic for --retest flag
How I got to this:
While re-running failed tests using --retest I noticed that the output:
"running x tests using y parallel processes".
was not actually correct, because x was the total number of tests present
in the directory, but it should be the number of failed tests. Although
it would run only the failed tests and later will say that remaining tests
were skipped.
Changes in test files reflect the fixed behaviour.
This patch change and move the logic for filtering failed test for
--retest option and make sure that we create instances of
class Test only for the tests we need to run.
As mentioned in the deleted text (in this patch itself) the logic
for --retest should be outside of TestSuite.
Differential Revision: https://phab.mercurial-scm.org/D8938
author | Sushil khanchi <sushilkhanchi97@gmail.com> |
---|---|
date | Sat, 22 Aug 2020 16:31:34 +0530 |
parents | d359f0d1a3d3 |
children | c102b704edb5 |
line wrap: on
line source
#!/usr/bin/env python # Filters traceback lines from stdin. from __future__ import absolute_import, print_function import io import sys if sys.version_info[0] >= 3: # Prevent \r from being inserted on Windows. sys.stdout = io.TextIOWrapper( sys.stdout.buffer, sys.stdout.encoding, sys.stdout.errors, newline="\n", line_buffering=sys.stdout.line_buffering, ) state = 'none' for line in sys.stdin: if state == 'none': if line.startswith('Traceback '): state = 'tb' elif state == 'tb': if line.startswith(' File '): state = 'file' continue elif not line.startswith(' '): state = 'none' elif state == 'file': # Ignore lines after " File " state = 'tb' continue print(line, end='')