From 1a73e78698490d3b91bf7a85f9b9864411f64dcb Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 14 Jul 2020 01:39:04 +0300 Subject: [PATCH] mark: fix typing for `@pytest.mark.xfail(raises=...)` --- src/_pytest/mark/structures.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/_pytest/mark/structures.py b/src/_pytest/mark/structures.py index 5a50cded0..c55e04755 100644 --- a/src/_pytest/mark/structures.py +++ b/src/_pytest/mark/structures.py @@ -28,6 +28,9 @@ from _pytest.config import Config from _pytest.outcomes import fail from _pytest.warning_types import PytestUnknownMarkWarning +if TYPE_CHECKING: + from typing import Type + EMPTY_PARAMETERSET_OPTION = "empty_parameter_set_mark" @@ -413,7 +416,9 @@ if TYPE_CHECKING: *conditions: Union[str, bool], reason: str = ..., run: bool = ..., - raises: Union[BaseException, Tuple[BaseException, ...]] = ..., + raises: Union[ + "Type[BaseException]", Tuple["Type[BaseException]", ...] + ] = ..., strict: bool = ... ) -> MarkDecorator: raise NotImplementedError()