Skip to content

Commit 8f231a6

Browse files
committed
Simplify findall
1 parent 70cae99 commit 8f231a6

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

‎Lib/test/test_regrtest.py‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,17 +1673,15 @@ def test_crash(self):
16731673
env.pop('SOURCE_DATE_EPOCH', None)
16741674
output = self.run_tests('--fast-ci', '-j2', cases, crash,
16751675
env=env, exitcode=EXITCODE_BAD_TEST)
1676-
fail_lines = [str(lineno)
1676+
# One annotation per failure of the re-run, not of the first run:
1677+
# one per "# fail" line, and the crash (without a line)
1678+
fail_lines = [(f'{cases}.py', str(lineno))
16771679
for lineno, line in enumerate(code.splitlines(), 1)
16781680
if line.endswith('# fail')]
1679-
# Only failures of the re-run are annotated
16801681
self.assertCountEqual(
1681-
re.findall(r'^::error file=[^,]*?([^/,]+?)(?:,line=(\d+))?,'
1682-
r'title=([^:]*)::', output, re.MULTILINE),
1683-
[(f'{cases}.py', fail_lines[1],
1684-
f'test_subtest ({cases}.Tests.test_subtest) (x=1)'),
1685-
(f'{cases}.py', fail_lines[0], f'doctest_fail ({cases}) [0]'),
1686-
(f'{crash}.py', '', crash)],
1682+
re.findall(r'^::error file=[^,]*?([^/,]+?)(?:,line=(\d+))?,title=',
1683+
output, re.MULTILINE),
1684+
fail_lines + [(f'{crash}.py', '')],
16871685
output)
16881686
with open(filename, encoding='utf-8') as fp:
16891687
summary = fp.read()

0 commit comments

Comments
 (0)