|
1 | 1 | """ hook specifications for pytest plugins, invoked from main.py and builtin plugins. """
|
2 | 2 | from typing import Any
|
| 3 | +from typing import Mapping |
3 | 4 | from typing import Optional
|
| 5 | +from typing import Tuple |
| 6 | +from typing import Union |
4 | 7 |
|
5 | 8 | from pluggy import HookspecMarker
|
6 | 9 |
|
7 | 10 | from .deprecated import COLLECT_DIRECTORY_HOOK
|
8 | 11 | from _pytest.compat import TYPE_CHECKING
|
9 | 12 |
|
10 | 13 | if TYPE_CHECKING:
|
| 14 | + from _pytest.config import Config |
11 | 15 | from _pytest.main import Session
|
| 16 | + from _pytest.reports import BaseReport |
12 | 17 |
|
13 | 18 |
|
14 | 19 | hookspec = HookspecMarker("pytest")
|
@@ -546,12 +551,32 @@ def pytest_report_collectionfinish(config, startdir, items):
|
546 | 551 |
|
547 | 552 |
|
548 | 553 | @hookspec(firstresult=True)
|
549 |
| -def pytest_report_teststatus(report, config): |
550 |
| - """ return result-category, shortletter and verbose word for reporting. |
| 554 | +def pytest_report_teststatus( |
| 555 | + report: "BaseReport", config: "Config" |
| 556 | +) -> Tuple[ |
| 557 | + str, str, Union[str, Mapping[str, bool]], |
| 558 | +]: |
| 559 | + """Return result-category, shortletter and verbose word for status |
| 560 | + reporting. |
551 | 561 |
|
552 |
| - :param _pytest.config.Config config: pytest config object |
| 562 | + The result-category is a category in which to count the result, for |
| 563 | + example "passed", "skipped", "error" or the empty string. |
553 | 564 |
|
554 |
| - Stops at first non-None result, see :ref:`firstresult` """ |
| 565 | + The shortletter is shown as testing progresses, for example ".", "s", |
| 566 | + "E" or the empty string. |
| 567 | +
|
| 568 | + The verbose word is shown as testing progresses in verbose mode, for |
| 569 | + example "PASSED", "SKIPPED", "ERROR" or the empty string. |
| 570 | +
|
| 571 | + pytest may style these implicitly according to the report outcome. |
| 572 | + To provide explicit styling, return a tuple for the verbose word, |
| 573 | + for example ``"rerun", "R", ("RERUN", {"yellow": True})``. |
| 574 | +
|
| 575 | + :param report: The report object whose status is to be returned. |
| 576 | + :param _pytest.config.Config config: The pytest config object. |
| 577 | +
|
| 578 | + Stops at first non-None result, see :ref:`firstresult`. |
| 579 | + """ |
555 | 580 |
|
556 | 581 |
|
557 | 582 | def pytest_terminal_summary(terminalreporter, exitstatus, config):
|
|
0 commit comments