[3.13] gh-129363: Change regrtest sequential mode output (GH-129476) (#130405)

gh-129363: Change regrtest sequential mode output (GH-129476)

First, write the test name without color. Then, write the test name
and the result with color. Each test is displayed twice.
(cherry picked from commit f1b81c408f)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2025-02-21 15:18:32 +01:00 committed by GitHub
parent 2a978e16d6
commit 8ce48c8ebc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 17 deletions

View file

@ -39,6 +39,17 @@ if not support.has_subprocess_support:
ROOT_DIR = os.path.join(os.path.dirname(__file__), '..', '..')
ROOT_DIR = os.path.abspath(os.path.normpath(ROOT_DIR))
LOG_PREFIX = r'[0-9]+:[0-9]+:[0-9]+ (?:load avg: [0-9]+\.[0-9]{2} )?'
RESULT_REGEX = (
'passed',
'failed',
'skipped',
'interrupted',
'env changed',
'timed out',
'ran no tests',
'worker non-zero exit code',
)
RESULT_REGEX = fr'(?:{"|".join(RESULT_REGEX)})'
EXITCODE_BAD_TEST = 2
EXITCODE_ENV_CHANGED = 3
@ -552,8 +563,8 @@ class BaseTestCase(unittest.TestCase):
self.assertRegex(output, regex)
def parse_executed_tests(self, output):
regex = (r'^%s\[ *[0-9]+(?:/ *[0-9]+)*\] (%s)'
% (LOG_PREFIX, self.TESTNAME_REGEX))
regex = (fr'^{LOG_PREFIX}\[ *[0-9]+(?:/ *[0-9]+)*\] '
fr'({self.TESTNAME_REGEX}) {RESULT_REGEX}')
parser = re.finditer(regex, output, re.MULTILINE)
return list(match.group(1) for match in parser)