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

View File

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

View File

@ -626,7 +626,8 @@ class LoggingPlugin:
finally:
self.log_file_handler.release()
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):
"""Return whether live logging is enabled."""