Change refactor so it doesn't break pytest-sugar
This commit is contained in:
parent
04555a8beb
commit
fb6b7ac181
1
AUTHORS
1
AUTHORS
|
@ -137,6 +137,7 @@ Erik Hasse
|
||||||
Erik M. Bray
|
Erik M. Bray
|
||||||
Evan Kepner
|
Evan Kepner
|
||||||
Evgeny Seliverstov
|
Evgeny Seliverstov
|
||||||
|
Fabian Sturm
|
||||||
Fabien Zarifian
|
Fabien Zarifian
|
||||||
Fabio Zadrozny
|
Fabio Zadrozny
|
||||||
Felix Hofstätter
|
Felix Hofstätter
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Report tracebacks for xfailures when ``-rx`` is set. Report captured output for xpasses when ``-rX`` is set. For xpasses, add ``-`` in summary between test name and reason, to match the format of xfail. Addresses issue #11233.
|
Report tracebacks for xfailures when ``-rx`` is set. Report captured output for xpasses when ``-rX`` is set. For xpasses, add ``-`` in summary between test name and reason, to match the format of xfail.
|
|
@ -877,11 +877,11 @@ class TerminalReporter:
|
||||||
@hookimpl(wrapper=True)
|
@hookimpl(wrapper=True)
|
||||||
def pytest_terminal_summary(self) -> Generator[None, None, None]:
|
def pytest_terminal_summary(self) -> Generator[None, None, None]:
|
||||||
self.summary_errors()
|
self.summary_errors()
|
||||||
self.summary_failures("failed", "FAILURES")
|
self.summary_failures()
|
||||||
self.summary_failures("xfailed", "XFAILURES", "x")
|
self.summary_xfailures()
|
||||||
self.summary_warnings()
|
self.summary_warnings()
|
||||||
self.summary_passes("passed", "PASSES", "P")
|
self.summary_passes()
|
||||||
self.summary_passes("xpassed", "XPASSES", "X")
|
self.summary_xpasses()
|
||||||
try:
|
try:
|
||||||
return (yield)
|
return (yield)
|
||||||
finally:
|
finally:
|
||||||
|
@ -1010,10 +1010,15 @@ class TerminalReporter:
|
||||||
"-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html"
|
"-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html"
|
||||||
)
|
)
|
||||||
|
|
||||||
def summary_passes(self,
|
def summary_passes(self) -> None:
|
||||||
which_reports: str,
|
self.summary_passes_combined("passed", "PASSES", "P")
|
||||||
sep_title: str,
|
|
||||||
needed_opt: str) -> None:
|
def summary_xpasses(self) -> None:
|
||||||
|
self.summary_passes_combined("xpassed", "XPASSES", "X")
|
||||||
|
|
||||||
|
def summary_passes_combined(
|
||||||
|
self, which_reports: str, sep_title: str, needed_opt: str
|
||||||
|
) -> None:
|
||||||
if self.config.option.tbstyle != "no":
|
if self.config.option.tbstyle != "no":
|
||||||
if self.hasopt(needed_opt):
|
if self.hasopt(needed_opt):
|
||||||
reports: List[TestReport] = self.getreports(which_reports)
|
reports: List[TestReport] = self.getreports(which_reports)
|
||||||
|
@ -1052,10 +1057,15 @@ class TerminalReporter:
|
||||||
content = content[:-1]
|
content = content[:-1]
|
||||||
self._tw.line(content)
|
self._tw.line(content)
|
||||||
|
|
||||||
def summary_failures(self,
|
def summary_failures(self) -> None:
|
||||||
which_reports: str,
|
self.summary_failures_combined("failed", "FAILURES")
|
||||||
sep_title: str,
|
|
||||||
needed_opt: Optional[str] = None) -> None:
|
def summary_xfailures(self) -> None:
|
||||||
|
self.summary_failures_combined("xfailed", "XFAILURES", "x")
|
||||||
|
|
||||||
|
def summary_failures_combined(
|
||||||
|
self, which_reports: str, sep_title: str, needed_opt: Optional[str] = None
|
||||||
|
) -> None:
|
||||||
if self.config.option.tbstyle != "no":
|
if self.config.option.tbstyle != "no":
|
||||||
if not needed_opt or self.hasopt(needed_opt):
|
if not needed_opt or self.hasopt(needed_opt):
|
||||||
reports: List[BaseReport] = self.getreports(which_reports)
|
reports: List[BaseReport] = self.getreports(which_reports)
|
||||||
|
|
Loading…
Reference in New Issue