diff --git a/mypy.ini b/mypy.ini index 5c1e286896..9f88c5c83b 100644 --- a/mypy.ini +++ b/mypy.ini @@ -40,8 +40,6 @@ strict_optional = True # Tests (may be many issues in file; comment is just one error noted) -[mypy-zerver/tests/test_logging_handlers] #73: error: Argument 7 to "makeRecord" of "Logger" has incompatible type "Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]"; expected "Union[Tuple[type, BaseException, TracebackType], Tuple[None, None, None], None]" -strict_optional = False [mypy-zerver/tests/test_decorators] #1322: error: Item "None" of "Optional[Match[str]]" has no attribute "groupdict" strict_optional = False [mypy-zerver/tests/test_auth_backends] #2079: error: Incompatible types in assignment (expression has type "Optional[UserProfile]", variable has type "UserProfile") diff --git a/zerver/tests/test_logging_handlers.py b/zerver/tests/test_logging_handlers.py index b73b1f5d08..9a38509095 100644 --- a/zerver/tests/test_logging_handlers.py +++ b/zerver/tests/test_logging_handlers.py @@ -2,7 +2,7 @@ import logging import sys from functools import wraps from types import TracebackType -from typing import Callable, Dict, Iterator, NoReturn, Optional, Tuple, Type, cast +from typing import Callable, Dict, Iterator, NoReturn, Optional, Tuple, Type, Union, cast from unittest.mock import MagicMock, patch from django.conf import settings @@ -15,7 +15,7 @@ from zerver.lib.types import ViewFuncT from zerver.logging_handlers import AdminNotifyHandler, HasRequest captured_request: Optional[HttpRequest] = None -captured_exc_info: Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]] = None +captured_exc_info: Optional[Union[Tuple[Type[BaseException], BaseException, TracebackType], Tuple[None, None, None]]] = None def capture_and_throw(domain: Optional[str]=None) -> Callable[[ViewFuncT], ViewFuncT]: def wrapper(view_func: ViewFuncT) -> ViewFuncT: @wraps(view_func)