summaryrefslogtreecommitdiff
path: root/src/_pytest/logging.py
diff options
context:
space:
mode:
authorRan Benita <ran@unusedvar.com>2020-05-01 14:40:17 +0300
committerRan Benita <ran@unusedvar.com>2020-06-05 11:34:20 +0300
commit54ad048be7182018e70479bd3d9b88bcb6376c00 (patch)
tree3681812c6c7e9dd9acd7c27a9b369ee860835e13 /src/_pytest/logging.py
parent71dfdca4df6961460653c265026e194fbcaebef2 (diff)
downloadpytest-54ad048be7182018e70479bd3d9b88bcb6376c00.tar.gz
Enable check_untyped_defs mypy option for testing/ too
Diffstat (limited to 'src/_pytest/logging.py')
-rw-r--r--src/_pytest/logging.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/_pytest/logging.py b/src/_pytest/logging.py
index ce3a18f03..c1f13b701 100644
--- a/src/_pytest/logging.py
+++ b/src/_pytest/logging.py
@@ -96,7 +96,7 @@ class PercentStyleMultiline(logging.PercentStyle):
formats the message as if each line were logged separately.
"""
- def __init__(self, fmt: str, auto_indent: Union[int, str, bool]) -> None:
+ def __init__(self, fmt: str, auto_indent: Union[int, str, bool, None]) -> None:
super().__init__(fmt)
self._auto_indent = self._get_auto_indent(auto_indent)
@@ -109,7 +109,7 @@ class PercentStyleMultiline(logging.PercentStyle):
return tmp
@staticmethod
- def _get_auto_indent(auto_indent_option: Union[int, str, bool]) -> int:
+ def _get_auto_indent(auto_indent_option: Union[int, str, bool, None]) -> int:
"""Determines the current auto indentation setting
Specify auto indent behavior (on/off/fixed) by passing in
@@ -139,7 +139,9 @@ class PercentStyleMultiline(logging.PercentStyle):
>0 (explicitly set indentation position).
"""
- if type(auto_indent_option) is int:
+ if auto_indent_option is None:
+ return 0
+ elif type(auto_indent_option) is int:
return int(auto_indent_option)
elif type(auto_indent_option) is str:
try:
@@ -732,7 +734,9 @@ class _LiveLoggingStreamHandler(logging.StreamHandler):
stream = None # type: TerminalReporter # type: ignore
def __init__(
- self, terminal_reporter: TerminalReporter, capture_manager: CaptureManager
+ self,
+ terminal_reporter: TerminalReporter,
+ capture_manager: Optional[CaptureManager],
) -> None:
"""
:param _pytest.terminal.TerminalReporter terminal_reporter: