Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #13082

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.8.3"
rev: "v0.8.4"
hooks:
- id: ruff
args: ["--fix"]
Expand All @@ -12,7 +12,7 @@ repos:
- id: end-of-file-fixer
- id: check-yaml
- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v0.9.2
rev: v0.10.0
hooks:
- id: zizmor
- repo: https://github.com/adamchainz/blacken-docs
Expand All @@ -32,7 +32,7 @@ repos:
hooks:
- id: python-use-type-annotations
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
rev: v1.14.0
hooks:
- id: mypy
files: ^(src/|testing/|scripts/)
Expand All @@ -54,7 +54,7 @@ repos:
# https://pyproject-fmt.readthedocs.io/en/latest/#calculating-max-supported-python-version
additional_dependencies: ["tox>=4.9"]
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.0
rev: v3.19.1
hooks:
- id: pyupgrade
args:
Expand Down
15 changes: 12 additions & 3 deletions src/_pytest/_py/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,24 @@
except OSError as value:
if not hasattr(value, "errno"):
raise
errno = value.errno
if sys.platform == "win32":
try:
cls = self._geterrnoclass(_winerrnomap[errno])
cls = self._geterrnoclass(_winerrnomap[value.errno])

Check warning on line 95 in src/_pytest/_py/error.py

View check run for this annotation

Codecov / codecov/patch

src/_pytest/_py/error.py#L95

Added line #L95 was not covered by tests
except KeyError:
raise value
else:
# we are not on Windows, or we got a proper OSError
cls = self._geterrnoclass(errno)
# Not sure if we should do that:
# if errno is None:
# clsname = errno.errorcode.get(errno, f"UnknownErrno{errno}")
# cls = type(
# clsname,
# (Error,),
# {"__module__": "py.error", "__doc__": os.strerror(errno)},
# )
# Or that:
assert isinstance(value.errno, int)
cls = self._geterrnoclass(value.errno)

raise cls(f"{func.__name__}{args!r}")

Expand Down
2 changes: 1 addition & 1 deletion src/_pytest/pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ def _import_module_using_spec(
if module_path.is_dir():
# The `spec_from_file_location` matches a loader based on the file extension by default.
# For a namespace package, need to manually specify a loader.
loader = NamespaceLoader(name, module_path, PathFinder())
loader = NamespaceLoader(name, module_path, PathFinder()) # type: ignore[arg-type]

spec = importlib.util.spec_from_file_location(
module_name, str(module_path), loader=loader
Expand Down
10 changes: 5 additions & 5 deletions src/_pytest/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ class Scope(Enum):
"""

# Scopes need to be listed from lower to higher.
Function: _ScopeName = "function"
Class: _ScopeName = "class"
Module: _ScopeName = "module"
Package: _ScopeName = "package"
Session: _ScopeName = "session"
Function = "function"
Class = "class"
Module = "module"
Package = "package"
Session = "session"

def next_lower(self) -> Scope:
"""Return the next lower scope."""
Expand Down
2 changes: 2 additions & 0 deletions testing/io/test_terminalwriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from collections.abc import Generator
import io
from io import StringIO
import os
from pathlib import Path
import re
Expand Down Expand Up @@ -68,6 +69,7 @@ def test_terminalwriter_not_unicode() -> None:
class TestTerminalWriter:
@pytest.fixture(params=["path", "stringio"])
def tw(self, request, tmp_path: Path) -> Generator[terminalwriter.TerminalWriter]:
f: io.TextIOWrapper | StringIO
if request.param == "path":
p = tmp_path.joinpath("tmpfile")
f = open(str(p), "w+", encoding="utf8")
Expand Down
Loading