From 8d413c1926e489e49f0a1b4df92b071288ec5d2b Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 16 Jul 2019 23:25:13 +0300 Subject: [PATCH] Allow tuple of exceptions in ExceptionInfo.errisinstance isinstance() accepts it and some code does pass a tuple. Fixup for commit 55a570e5135cc8e08f242794b2b7a38677d81838. --- src/_pytest/_code/code.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/_pytest/_code/code.py b/src/_pytest/_code/code.py index 30ab01235..7d72234e7 100644 --- a/src/_pytest/_code/code.py +++ b/src/_pytest/_code/code.py @@ -520,7 +520,9 @@ class ExceptionInfo(Generic[_E]): text = text[len(self._striptext) :] return text - def errisinstance(self, exc: "Type[BaseException]") -> bool: + def errisinstance( + self, exc: Union["Type[BaseException]", Tuple["Type[BaseException]", ...]] + ) -> bool: """ return True if the exception is an instance of exc """ return isinstance(self.value, exc)