diff --git a/src/_pytest/python_api.py b/src/_pytest/python_api.py index ddbf9b87251..5fd9c5124d5 100644 --- a/src/_pytest/python_api.py +++ b/src/_pytest/python_api.py @@ -1017,7 +1017,7 @@ def validate_exc(exc: type[E]) -> type[E]: raise TypeError(f"{func!r} object (type: {type(func)}) must be callable") try: func(*args[1:], **kwargs) - except expected_exceptions as e: + except expected_exceptions as e: # pylint: disable=catching-non-exception return _pytest._code.ExceptionInfo.from_exception(e) fail(message)