hookspec: type annotate pytest_runtest_log{start,finish}
This commit is contained in:
parent
bb7b3af9b9
commit
314d00968a
|
@ -396,7 +396,9 @@ def pytest_runtest_protocol(
|
||||||
Stops at first non-None result, see :ref:`firstresult` """
|
Stops at first non-None result, see :ref:`firstresult` """
|
||||||
|
|
||||||
|
|
||||||
def pytest_runtest_logstart(nodeid, location):
|
def pytest_runtest_logstart(
|
||||||
|
nodeid: str, location: Tuple[str, Optional[int], str]
|
||||||
|
) -> None:
|
||||||
""" signal the start of running a single test item.
|
""" signal the start of running a single test item.
|
||||||
|
|
||||||
This hook will be called **before** :func:`pytest_runtest_setup`, :func:`pytest_runtest_call` and
|
This hook will be called **before** :func:`pytest_runtest_setup`, :func:`pytest_runtest_call` and
|
||||||
|
@ -407,7 +409,9 @@ def pytest_runtest_logstart(nodeid, location):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def pytest_runtest_logfinish(nodeid, location):
|
def pytest_runtest_logfinish(
|
||||||
|
nodeid: str, location: Tuple[str, Optional[int], str]
|
||||||
|
) -> None:
|
||||||
""" signal the complete finish of running a single test item.
|
""" signal the complete finish of running a single test item.
|
||||||
|
|
||||||
This hook will be called **after** :func:`pytest_runtest_setup`, :func:`pytest_runtest_call` and
|
This hook will be called **after** :func:`pytest_runtest_setup`, :func:`pytest_runtest_call` and
|
||||||
|
|
|
@ -653,12 +653,12 @@ class LoggingPlugin:
|
||||||
yield # run all the tests
|
yield # run all the tests
|
||||||
|
|
||||||
@pytest.hookimpl
|
@pytest.hookimpl
|
||||||
def pytest_runtest_logstart(self):
|
def pytest_runtest_logstart(self) -> None:
|
||||||
self.log_cli_handler.reset()
|
self.log_cli_handler.reset()
|
||||||
self.log_cli_handler.set_when("start")
|
self.log_cli_handler.set_when("start")
|
||||||
|
|
||||||
@pytest.hookimpl
|
@pytest.hookimpl
|
||||||
def pytest_runtest_logreport(self):
|
def pytest_runtest_logreport(self) -> None:
|
||||||
self.log_cli_handler.set_when("logreport")
|
self.log_cli_handler.set_when("logreport")
|
||||||
|
|
||||||
def _runtest_for(self, item: nodes.Item, when: str) -> Generator[None, None, None]:
|
def _runtest_for(self, item: nodes.Item, when: str) -> Generator[None, None, None]:
|
||||||
|
|
|
@ -502,7 +502,9 @@ class TerminalReporter:
|
||||||
def pytest_deselected(self, items) -> None:
|
def pytest_deselected(self, items) -> None:
|
||||||
self._add_stats("deselected", items)
|
self._add_stats("deselected", items)
|
||||||
|
|
||||||
def pytest_runtest_logstart(self, nodeid, location) -> None:
|
def pytest_runtest_logstart(
|
||||||
|
self, nodeid: str, location: Tuple[str, Optional[int], str]
|
||||||
|
) -> None:
|
||||||
# ensure that the path is printed before the
|
# ensure that the path is printed before the
|
||||||
# 1st test of a module starts running
|
# 1st test of a module starts running
|
||||||
if self.showlongtestinfo:
|
if self.showlongtestinfo:
|
||||||
|
@ -569,7 +571,7 @@ class TerminalReporter:
|
||||||
assert self._session is not None
|
assert self._session is not None
|
||||||
return len(self._progress_nodeids_reported) == self._session.testscollected
|
return len(self._progress_nodeids_reported) == self._session.testscollected
|
||||||
|
|
||||||
def pytest_runtest_logfinish(self, nodeid) -> None:
|
def pytest_runtest_logfinish(self, nodeid: str) -> None:
|
||||||
assert self._session
|
assert self._session
|
||||||
if self.verbosity <= 0 and self._show_progress_info:
|
if self.verbosity <= 0 and self._show_progress_info:
|
||||||
if self._show_progress_info == "count":
|
if self._show_progress_info == "count":
|
||||||
|
|
Loading…
Reference in New Issue