diff options
author | Ran Benita <ran@unusedvar.com> | 2020-05-01 14:40:15 +0300 |
---|---|---|
committer | Ran Benita <ran@unusedvar.com> | 2020-06-05 11:34:19 +0300 |
commit | 247c4c0482888b18203589a2d0461d598bd2d817 (patch) | |
tree | 917e1946bc1a161457d159b468a7940b3efd66bb /src/_pytest/logging.py | |
parent | ef347295418451e1f09bfb9af1a77aba10b3e71c (diff) | |
download | pytest-247c4c0482888b18203589a2d0461d598bd2d817.tar.gz |
Type annotate some more hooks & impls
Diffstat (limited to 'src/_pytest/logging.py')
-rw-r--r-- | src/_pytest/logging.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/_pytest/logging.py b/src/_pytest/logging.py index b832f6994..92046ed51 100644 --- a/src/_pytest/logging.py +++ b/src/_pytest/logging.py @@ -20,6 +20,7 @@ from _pytest.config import _strtobool from _pytest.config import Config from _pytest.config import create_terminal_writer from _pytest.config.argparsing import Parser +from _pytest.main import Session from _pytest.pathlib import Path from _pytest.store import StoreKey @@ -618,7 +619,7 @@ class LoggingPlugin: yield @pytest.hookimpl(hookwrapper=True) - def pytest_runtestloop(self, session): + def pytest_runtestloop(self, session: Session) -> Generator[None, None, None]: """Runs all collected test items.""" if session.config.option.collectonly: @@ -655,20 +656,21 @@ class LoggingPlugin: item.add_report_section(when, "log", log) @pytest.hookimpl(hookwrapper=True) - def pytest_runtest_setup(self, item): + def pytest_runtest_setup(self, item: nodes.Item) -> Generator[None, None, None]: self.log_cli_handler.set_when("setup") - item._store[catch_log_records_key] = {} + empty = {} # type: Dict[str, List[logging.LogRecord]] + item._store[catch_log_records_key] = empty yield from self._runtest_for(item, "setup") @pytest.hookimpl(hookwrapper=True) - def pytest_runtest_call(self, item): + def pytest_runtest_call(self, item: nodes.Item) -> Generator[None, None, None]: self.log_cli_handler.set_when("call") yield from self._runtest_for(item, "call") @pytest.hookimpl(hookwrapper=True) - def pytest_runtest_teardown(self, item): + def pytest_runtest_teardown(self, item: nodes.Item) -> Generator[None, None, None]: self.log_cli_handler.set_when("teardown") yield from self._runtest_for(item, "teardown") @@ -676,7 +678,7 @@ class LoggingPlugin: del item._store[catch_log_handler_key] @pytest.hookimpl - def pytest_runtest_logfinish(self): + def pytest_runtest_logfinish(self) -> None: self.log_cli_handler.set_when("finish") @pytest.hookimpl(hookwrapper=True, tryfirst=True) |