Merge pull request #9128 from pytest-dev/pre-commit-ci-update-config

[pre-commit.ci] pre-commit autoupdate
This commit is contained in:
Bruno Oliveira 2021-09-27 20:37:57 -03:00 committed by GitHub
commit dd6d4b2fe0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 19 deletions

View File

@ -34,7 +34,7 @@ repos:
- id: reorder-python-imports - id: reorder-python-imports
args: ['--application-directories=.:src', --py36-plus] args: ['--application-directories=.:src', --py36-plus]
- repo: https://github.com/asottile/pyupgrade - repo: https://github.com/asottile/pyupgrade
rev: v2.26.0 rev: v2.28.0
hooks: hooks:
- id: pyupgrade - id: pyupgrade
args: [--py36-plus] args: [--py36-plus]

View File

@ -392,8 +392,7 @@ class MyOptionParser(argparse.ArgumentParser):
prog: Optional[str] = None, prog: Optional[str] = None,
) -> None: ) -> None:
self._parser = parser self._parser = parser
argparse.ArgumentParser.__init__( super().__init__(
self,
prog=prog, prog=prog,
usage=parser._usage, usage=parser._usage,
add_help=False, add_help=False,
@ -486,7 +485,7 @@ class DropShorterLongHelpFormatter(argparse.HelpFormatter):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
def _format_action_invocation(self, action: argparse.Action) -> str: def _format_action_invocation(self, action: argparse.Action) -> str:
orgstr = argparse.HelpFormatter._format_action_invocation(self, action) orgstr = super()._format_action_invocation(action)
if orgstr and orgstr[0] != "-": # only optional arguments if orgstr and orgstr[0] != "-": # only optional arguments
return orgstr return orgstr
res: Optional[str] = getattr(action, "_formatted_action_invocation", None) res: Optional[str] = getattr(action, "_formatted_action_invocation", None)

View File

@ -190,8 +190,7 @@ def _init_runner_class() -> Type["doctest.DocTestRunner"]:
optionflags: int = 0, optionflags: int = 0,
continue_on_failure: bool = True, continue_on_failure: bool = True,
) -> None: ) -> None:
doctest.DebugRunner.__init__( super().__init__(checker=checker, verbose=verbose, optionflags=optionflags
self, checker=checker, verbose=verbose, optionflags=optionflags
) )
self.continue_on_failure = continue_on_failure self.continue_on_failure = continue_on_failure
@ -513,8 +512,7 @@ class DoctestModule(pytest.Module):
if isinstance(obj, property): if isinstance(obj, property):
obj = getattr(obj, "fget", obj) obj = getattr(obj, "fget", obj)
# Type ignored because this is a private function. # Type ignored because this is a private function.
return doctest.DocTestFinder._find_lineno( # type: ignore return super()._find_lineno(
self,
obj, obj,
source_lines, source_lines,
) )
@ -527,8 +525,7 @@ class DoctestModule(pytest.Module):
with _patch_unwrap_mock_aware(): with _patch_unwrap_mock_aware():
# Type ignored because this is a private function. # Type ignored because this is a private function.
doctest.DocTestFinder._find( # type: ignore super()._find(tests, obj, name, module, source_lines, globs, seen
self, tests, obj, name, module, source_lines, globs, seen
) )
if self.path.name == "conftest.py": if self.path.name == "conftest.py":
@ -613,7 +610,7 @@ def _init_checker_class() -> Type["doctest.OutputChecker"]:
) )
def check_output(self, want: str, got: str, optionflags: int) -> bool: def check_output(self, want: str, got: str, optionflags: int) -> bool:
if doctest.OutputChecker.check_output(self, want, got, optionflags): if super().check_output(want, got, optionflags):
return True return True
allow_unicode = optionflags & _get_allow_unicode_flag() allow_unicode = optionflags & _get_allow_unicode_flag()
@ -637,7 +634,7 @@ def _init_checker_class() -> Type["doctest.OutputChecker"]:
if allow_number: if allow_number:
got = self._remove_unwanted_precision(want, got) got = self._remove_unwanted_precision(want, got)
return doctest.OutputChecker.check_output(self, want, got, optionflags) return super().check_output(want, got, optionflags)
def _remove_unwanted_precision(self, want: str, got: str) -> str: def _remove_unwanted_precision(self, want: str, got: str) -> str:
wants = list(self._number_re.finditer(want)) wants = list(self._number_re.finditer(want))

View File

@ -784,7 +784,7 @@ class _LiveLoggingStreamHandler(logging.StreamHandler):
terminal_reporter: TerminalReporter, terminal_reporter: TerminalReporter,
capture_manager: Optional[CaptureManager], capture_manager: Optional[CaptureManager],
) -> None: ) -> None:
logging.StreamHandler.__init__(self, stream=terminal_reporter) # type: ignore[arg-type] super().__init__(stream=terminal_reporter) # type: ignore[arg-type]
self.capture_manager = capture_manager self.capture_manager = capture_manager
self.reset() self.reset()
self.set_when(None) self.set_when(None)

View File

@ -33,7 +33,7 @@ class OutcomeException(BaseException):
"Perhaps you meant to use a mark?" "Perhaps you meant to use a mark?"
) )
raise TypeError(error_msg.format(type(self).__name__, type(msg).__name__)) raise TypeError(error_msg.format(type(self).__name__, type(msg).__name__))
BaseException.__init__(self, msg) super().__init__(msg)
self.msg = msg self.msg = msg
self.pytrace = pytrace self.pytrace = pytrace
@ -61,7 +61,7 @@ class Skipped(OutcomeException):
*, *,
_use_item_location: bool = False, _use_item_location: bool = False,
) -> None: ) -> None:
OutcomeException.__init__(self, msg=msg, pytrace=pytrace) super().__init__(msg=msg, pytrace=pytrace)
self.allow_module_level = allow_module_level self.allow_module_level = allow_module_level
# If true, the skip location is reported as the item's location, # If true, the skip location is reported as the item's location,
# instead of the place that raises the exception/calls skip(). # instead of the place that raises the exception/calls skip().

View File

@ -221,7 +221,7 @@ class ApproxNumpy(ApproxBase):
if not np.isscalar(actual) and actual.shape != self.expected.shape: if not np.isscalar(actual) and actual.shape != self.expected.shape:
return False return False
return ApproxBase.__eq__(self, actual) return super().__eq__(actual)
def _yield_comparisons(self, actual): def _yield_comparisons(self, actual):
import numpy as np import numpy as np
@ -292,7 +292,7 @@ class ApproxMapping(ApproxBase):
except AttributeError: except AttributeError:
return False return False
return ApproxBase.__eq__(self, actual) return super().__eq__(actual)
def _yield_comparisons(self, actual): def _yield_comparisons(self, actual):
for k in self.expected.keys(): for k in self.expected.keys():
@ -365,7 +365,7 @@ class ApproxSequencelike(ApproxBase):
return False return False
except TypeError: except TypeError:
return False return False
return ApproxBase.__eq__(self, actual) return super().__eq__(actual)
def _yield_comparisons(self, actual): def _yield_comparisons(self, actual):
return zip(actual, self.expected) return zip(actual, self.expected)

View File

@ -322,7 +322,7 @@ class TestCaseFunction(Function):
def _prunetraceback( def _prunetraceback(
self, excinfo: _pytest._code.ExceptionInfo[BaseException] self, excinfo: _pytest._code.ExceptionInfo[BaseException]
) -> None: ) -> None:
Function._prunetraceback(self, excinfo) super()._prunetraceback(excinfo)
traceback = excinfo.traceback.filter( traceback = excinfo.traceback.filter(
lambda x: not x.frame.f_globals.get("__unittest") lambda x: not x.frame.f_globals.get("__unittest")
) )