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 textwrap
import warnings import warnings
from collections import Counter from collections import Counter
from collections import namedtuple
from functools import partial from functools import partial
from pathlib import Path from pathlib import Path
from typing import Any from typing import Any
@ -548,10 +549,11 @@ class TerminalReporter:
def pytest_runtest_logreport(self, report: TestReport) -> None: def pytest_runtest_logreport(self, report: TestReport) -> None:
self._tests_ran = True self._tests_ran = True
rep = report rep = report
res: Tuple[ Res = namedtuple("Res", ["category", "letter", "word"])
str, str, Union[str, Tuple[str, Mapping[str, bool]]] res = Res(
] = self.config.hook.pytest_report_teststatus(report=rep, config=self.config) *self.config.hook.pytest_report_teststatus(report=rep, config=self.config)
category, letter, word = res )
category, letter, word = res.category, res.letter, res.word
if not isinstance(word, tuple): if not isinstance(word, tuple):
markup = None markup = None
else: else: