Use named tuple instead of vanilla tuple

This commit is contained in:
Roberto Aldera 2023-05-08 19:30:03 +02:00
parent 7d548c38e2
commit 44ee84bce5
No known key found for this signature in database
1 changed files with 6 additions and 4 deletions

View File

@ -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: