Skip to content

Commit 8d413c1

Browse files
committed
Allow tuple of exceptions in ExceptionInfo.errisinstance
isinstance() accepts it and some code does pass a tuple. Fixup for commit 55a570e.
1 parent 104f8fc commit 8d413c1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/_pytest/_code/code.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,9 @@ def exconly(self, tryshort: bool = False) -> str:
520520
text = text[len(self._striptext) :]
521521
return text
522522

523-
def errisinstance(self, exc: "Type[BaseException]") -> bool:
523+
def errisinstance(
524+
self, exc: Union["Type[BaseException]", Tuple["Type[BaseException]", ...]]
525+
) -> bool:
524526
""" return True if the exception is an instance of exc """
525527
return isinstance(self.value, exc)
526528

0 commit comments

Comments
 (0)