Skip to content

Commit 37a283b

Browse files
committed
fix typing for raises-func: does not return None
1 parent bdf40d1 commit 37a283b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/_pytest/python_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ def raises( # noqa: F811
558558
func: Callable,
559559
*args: Any,
560560
**kwargs: Any
561-
) -> Optional[_pytest._code.ExceptionInfo[_E]]:
561+
) -> _pytest._code.ExceptionInfo[_E]:
562562
... # pragma: no cover
563563

564564

testing/python/raises.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def __call__(self):
187187

188188
assert refcount == len(gc.get_referrers(t))
189189

190-
def test_raises_match(self):
190+
def test_raises_match(self) -> None:
191191
msg = r"with base \d+"
192192
with pytest.raises(ValueError, match=msg):
193193
int("asdf")
@@ -215,8 +215,8 @@ def test_raises_match(self):
215215
def tfunc(match):
216216
raise ValueError("match={}".format(match))
217217

218-
excinfo = pytest.raises(ValueError, tfunc, match="asdf").match("match=asdf")
219-
excinfo = pytest.raises(ValueError, tfunc, match="").match("match=")
218+
pytest.raises(ValueError, tfunc, match="asdf").match("match=asdf")
219+
pytest.raises(ValueError, tfunc, match="").match("match=")
220220

221221
def test_match_failure_string_quoting(self):
222222
with pytest.raises(AssertionError) as excinfo:

0 commit comments

Comments
 (0)