From 44ee84bce51bcc7c9edb7d84521c1829b99ae82c Mon Sep 17 00:00:00 2001 From: Roberto Aldera <51328612+roberto-aldera@users.noreply.github.com> Date: Mon, 8 May 2023 19:30:03 +0200 Subject: [PATCH] Use named tuple instead of vanilla tuple --- src/_pytest/terminal.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/_pytest/terminal.py b/src/_pytest/terminal.py index b7793d398..305ff10ea 100644 --- a/src/_pytest/terminal.py +++ b/src/_pytest/terminal.py @@ -11,6 +11,7 @@ import sys import textwrap import warnings from collections import Counter +from collections import namedtuple from functools import partial from pathlib import Path from typing import Any @@ -548,10 +549,11 @@ class TerminalReporter: def pytest_runtest_logreport(self, report: TestReport) -> None: self._tests_ran = True rep = report - res: Tuple[ - str, str, Union[str, Tuple[str, Mapping[str, bool]]] - ] = self.config.hook.pytest_report_teststatus(report=rep, config=self.config) - category, letter, word = res + Res = namedtuple("Res", ["category", "letter", "word"]) + res = Res( + *self.config.hook.pytest_report_teststatus(report=rep, config=self.config) + ) + category, letter, word = res.category, res.letter, res.word if not isinstance(word, tuple): markup = None else: