summaryrefslogtreecommitdiff
path: root/src/_pytest/hookspec.py
diff options
context:
space:
mode:
authorRan Benita <ran@unusedvar.com>2020-06-08 16:08:46 +0300
committerRan Benita <ran@unusedvar.com>2020-06-12 17:34:31 +0300
commit0256cb3aae7221909244d187ed912716fcc5aa5e (patch)
tree1be4b11f8d2b752b9795d7144d75fe3c02e74c93 /src/_pytest/hookspec.py
parent7081ed19b892a799e1dea99a7922cab79fefc1df (diff)
downloadpytest-0256cb3aae7221909244d187ed912716fcc5aa5e.tar.gz
hookspec: type annotate pytest_internalerror
Also switch to using ExceptionRepr instead of `Union[ReprExceptionInfo, ExceptionChainRepr]` which is somewhat annoying and less future proof.
Diffstat (limited to 'src/_pytest/hookspec.py')
-rw-r--r--src/_pytest/hookspec.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/_pytest/hookspec.py b/src/_pytest/hookspec.py
index a6decb03a..1c1726d53 100644
--- a/src/_pytest/hookspec.py
+++ b/src/_pytest/hookspec.py
@@ -19,6 +19,7 @@ if TYPE_CHECKING:
import warnings
from typing_extensions import Literal
+ from _pytest._code.code import ExceptionRepr
from _pytest.code import ExceptionInfo
from _pytest.config import Config
from _pytest.config import ExitCode
@@ -759,8 +760,14 @@ def pytest_doctest_prepare_content(content):
# -------------------------------------------------------------------------
-def pytest_internalerror(excrepr, excinfo):
- """ called for internal errors. """
+def pytest_internalerror(
+ excrepr: "ExceptionRepr", excinfo: "ExceptionInfo[BaseException]",
+) -> Optional[bool]:
+ """Called for internal errors.
+
+ Return True to suppress the fallback handling of printing an
+ INTERNALERROR message directly to sys.stderr.
+ """
def pytest_keyboard_interrupt(