summaryrefslogtreecommitdiff
path: root/src/_pytest/hookspec.py
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2020-01-28 17:05:41 +0100
committerDaniel Hahler <git@thequod.de>2020-01-30 19:58:43 +0100
commit88b800355a42a697aad123fb9546e4dbadc2cf34 (patch)
tree1f8d6c6c534f2ebd147dabd6663566e2b0350152 /src/_pytest/hookspec.py
parenteb5e651d7eaf23c2ef73afe3892f268b191d2db0 (diff)
downloadpytest-88b800355a42a697aad123fb9546e4dbadc2cf34.tar.gz
typing: pytest_collection
Diffstat (limited to 'src/_pytest/hookspec.py')
-rw-r--r--src/_pytest/hookspec.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/_pytest/hookspec.py b/src/_pytest/hookspec.py
index 03e060eb8..2d9834c7f 100644
--- a/src/_pytest/hookspec.py
+++ b/src/_pytest/hookspec.py
@@ -1,6 +1,14 @@
""" hook specifications for pytest plugins, invoked from main.py and builtin plugins. """
+from typing import Any
+from typing import Optional
+
from pluggy import HookspecMarker
+from _pytest.compat import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from _pytest.main import Session
+
hookspec = HookspecMarker("pytest")
@@ -158,7 +166,7 @@ def pytest_load_initial_conftests(early_config, parser, args):
@hookspec(firstresult=True)
-def pytest_collection(session):
+def pytest_collection(session: "Session") -> Optional[Any]:
"""Perform the collection protocol for the given session.
Stops at first non-None result, see :ref:`firstresult`.