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

This commit is contained in:
Bruno Oliveira 2021-06-20 12:27:03 -03:00 committed by GitHub
commit 68b329dda8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 7 deletions

View File

@ -1,6 +1,6 @@
repos: repos:
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 21.5b2 rev: 21.6b0
hooks: hooks:
- id: black - id: black
args: [--safe, --quiet] args: [--safe, --quiet]
@ -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.19.1 rev: v2.19.4
hooks: hooks:
- id: pyupgrade - id: pyupgrade
args: [--py36-plus] args: [--py36-plus]
@ -44,11 +44,11 @@ repos:
- id: setup-cfg-fmt - id: setup-cfg-fmt
args: [--max-py-version=3.10] args: [--max-py-version=3.10]
- repo: https://github.com/pre-commit/pygrep-hooks - repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.8.0 rev: v1.9.0
hooks: hooks:
- id: python-use-type-annotations - id: python-use-type-annotations
- repo: https://github.com/pre-commit/mirrors-mypy - repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.812 rev: v0.902
hooks: hooks:
- id: mypy - id: mypy
files: ^(src/|testing/) files: ^(src/|testing/)
@ -58,6 +58,8 @@ repos:
- py>=1.8.2 - py>=1.8.2
- attrs>=19.2.0 - attrs>=19.2.0
- packaging - packaging
- types-toml
- types-pkg_resources
- repo: local - repo: local
hooks: hooks:
- id: rst - id: rst

View File

@ -48,6 +48,7 @@ from _pytest.pathlib import bestrelpath
if TYPE_CHECKING: if TYPE_CHECKING:
from typing_extensions import Literal from typing_extensions import Literal
from typing_extensions import SupportsIndex
from weakref import ReferenceType from weakref import ReferenceType
_TracebackStyle = Literal["long", "short", "line", "no", "native", "value", "auto"] _TracebackStyle = Literal["long", "short", "line", "no", "native", "value", "auto"]
@ -371,14 +372,16 @@ class Traceback(List[TracebackEntry]):
return self return self
@overload @overload
def __getitem__(self, key: int) -> TracebackEntry: def __getitem__(self, key: "SupportsIndex") -> TracebackEntry:
... ...
@overload @overload
def __getitem__(self, key: slice) -> "Traceback": def __getitem__(self, key: slice) -> "Traceback":
... ...
def __getitem__(self, key: Union[int, slice]) -> Union[TracebackEntry, "Traceback"]: def __getitem__(
self, key: Union["SupportsIndex", slice]
) -> Union[TracebackEntry, "Traceback"]:
if isinstance(key, slice): if isinstance(key, slice):
return self.__class__(super().__getitem__(key)) return self.__class__(super().__getitem__(key))
else: else:

View File

@ -626,7 +626,8 @@ class LoggingPlugin:
finally: finally:
self.log_file_handler.release() self.log_file_handler.release()
if old_stream: if old_stream:
old_stream.close() # https://github.com/python/typeshed/pull/5663
old_stream.close() # type:ignore[attr-defined]
def _log_cli_enabled(self): def _log_cli_enabled(self):
"""Return whether live logging is enabled.""" """Return whether live logging is enabled."""