From 8842c5e7f94202be3c9a23ec9005ffa62c14d01d Mon Sep 17 00:00:00 2001 From: AlexWaygood Date: Thu, 27 Jul 2023 23:17:13 +0100 Subject: [PATCH 1/2] Argument clinic tests: improve failure message when tests in `ClinicExternalTests` fail --- Lib/test/test_clinic.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_clinic.py b/Lib/test/test_clinic.py index d21c7d84c88d2d..cb695cc6e0a752 100644 --- a/Lib/test/test_clinic.py +++ b/Lib/test/test_clinic.py @@ -10,6 +10,7 @@ from unittest import TestCase import collections import inspect +import itertools import os.path import subprocess import sys @@ -1386,7 +1387,7 @@ def _do_test(self, *args, expect_success=True): ) as proc: proc.wait() if expect_success and proc.returncode: - self.fail("".join(proc.stderr)) + self.fail("".join(itertools.chain(proc.stdout, proc.stderr))) stdout = proc.stdout.read() stderr = proc.stderr.read() # Clinic never writes to stderr. From 81ebc8572ea49761dd5a24375eaf41430bff0818 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 28 Jul 2023 00:14:48 +0100 Subject: [PATCH 2/2] RIP itertools.chain: gone but not forgotten --- Lib/test/test_clinic.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_clinic.py b/Lib/test/test_clinic.py index cb695cc6e0a752..2f74ee29b204db 100644 --- a/Lib/test/test_clinic.py +++ b/Lib/test/test_clinic.py @@ -10,7 +10,6 @@ from unittest import TestCase import collections import inspect -import itertools import os.path import subprocess import sys @@ -1387,7 +1386,7 @@ def _do_test(self, *args, expect_success=True): ) as proc: proc.wait() if expect_success and proc.returncode: - self.fail("".join(itertools.chain(proc.stdout, proc.stderr))) + self.fail("".join([*proc.stdout, *proc.stderr])) stdout = proc.stdout.read() stderr = proc.stderr.read() # Clinic never writes to stderr.