Skip to content

Commit 5c28d9c

Browse files
[pre-commit.ci] pre-commit autoupdate (#3279)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Bernát Gábor <[email protected]>
1 parent f4e257c commit 5c28d9c

File tree

9 files changed

+52
-23
lines changed

9 files changed

+52
-23
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repos:
55
- id: end-of-file-fixer
66
- id: trailing-whitespace
77
- repo: https://github.com/python-jsonschema/check-jsonschema
8-
rev: 0.28.2
8+
rev: 0.28.3
99
hooks:
1010
- id: check-github-workflows
1111
args: [ "--verbose" ]
@@ -20,12 +20,11 @@ repos:
2020
- id: tox-ini-fmt
2121
args: ["-p", "fix"]
2222
- repo: https://github.com/tox-dev/pyproject-fmt
23-
rev: "1.8.0"
23+
rev: "2.0.4"
2424
hooks:
2525
- id: pyproject-fmt
26-
additional_dependencies: ["tox>=4.14.2"]
2726
- repo: https://github.com/astral-sh/ruff-pre-commit
28-
rev: "v0.4.2"
27+
rev: "v0.4.4"
2928
hooks:
3029
- id: ruff-format
3130
- id: ruff

pyproject.toml

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ maintainers = [
2323
{ name = "Jürgen Gmach", email = "[email protected]" },
2424
{ name = "Oliver Bestwalter", email = "[email protected]" },
2525
]
26-
authors = [{ name = "Bernát Gábor", email = "[email protected]" }]
26+
authors = [
27+
{ name = "Bernát Gábor", email = "[email protected]" },
28+
]
2729
requires-python = ">=3.8"
2830
classifiers = [
2931
"Development Status :: 5 - Production/Stable",
@@ -51,13 +53,13 @@ dependencies = [
5153
"chardet>=5.2",
5254
"colorama>=0.4.6",
5355
"filelock>=3.13.1",
54-
'importlib-metadata>=7.0.1; python_version < "3.8"',
56+
"importlib-metadata>=7.0.1; python_version<'3.8'",
5557
"packaging>=23.2",
5658
"platformdirs>=4.1",
5759
"pluggy>=1.3",
5860
"pyproject-api>=1.6.1",
59-
'tomli>=2.0.1; python_version < "3.11"',
60-
'typing-extensions>=4.9; python_version < "3.8"',
61+
"tomli>=2.0.1; python_version<'3.11'",
62+
"typing-extensions>=4.9; python_version<'3.8'",
6163
"virtualenv>=20.25",
6264
]
6365
optional-dependencies.docs = [
@@ -86,7 +88,7 @@ optional-dependencies.testing = [
8688
"pytest-mock>=3.12",
8789
"pytest-xdist>=3.5",
8890
"re-assert>=1.1",
89-
'time-machine>=2.13; implementation_name != "pypy"',
91+
"time-machine>=2.13; implementation_name!='pypy'",
9092
"wheel>=0.42",
9193
]
9294
urls.Documentation = "https://tox.wiki"
@@ -97,16 +99,29 @@ urls.Tracker = "https://github.com/tox-dev/tox/issues"
9799
scripts.tox = "tox.run:run"
98100

99101
[tool.hatch]
100-
build.dev-mode-dirs = ["src"]
102+
build.dev-mode-dirs = [
103+
"src",
104+
]
101105
build.hooks.vcs.version-file = "src/tox/version.py"
102-
build.targets.sdist.include = ["/src", "/tests", "/tox.ini"]
106+
build.targets.sdist.include = [
107+
"/src",
108+
"/tests",
109+
"/tox.ini",
110+
]
103111
version.source = "vcs"
104112

105113
[tool.ruff]
106114
line-length = 120
107115
target-version = "py38"
108-
lint.isort = { known-first-party = ["tox", "tests"], required-imports = ["from __future__ import annotations"] }
109-
lint.select = ["ALL"]
116+
lint.isort = { known-first-party = [
117+
"tox",
118+
"tests",
119+
], required-imports = [
120+
"from __future__ import annotations",
121+
] }
122+
lint.select = [
123+
"ALL",
124+
]
110125
lint.ignore = [
111126
"CPY", # No copyright header
112127
"INP001", # no implicit namespaces here
@@ -145,7 +160,9 @@ ignore-words = "ignore-words.txt"
145160
count = true
146161

147162
[tool.pytest.ini_options]
148-
testpaths = ["tests"]
163+
testpaths = [
164+
"tests",
165+
]
149166
addopts = "--tb=auto -ra --showlocals --no-success-flaky-report"
150167

151168
[tool.coverage]
@@ -160,9 +177,15 @@ paths.source = [
160177
"*\\src",
161178
]
162179
report.fail_under = 88
163-
report.omit = ["src/tox/config/cli/for_docs.py", "tests/execute/local_subprocess/bad_process.py", "tests/type_check/*"]
180+
report.omit = [
181+
"src/tox/config/cli/for_docs.py",
182+
"tests/execute/local_subprocess/bad_process.py",
183+
"tests/type_check/*",
184+
]
164185
run.parallel = true
165-
run.plugins = ["covdefaults"]
186+
run.plugins = [
187+
"covdefaults",
188+
]
166189

167190
[tool.towncrier]
168191
name = "tox"

src/tox/config/cli/parse.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
import locale
56
import os
67
from contextlib import redirect_stderr
78
from pathlib import Path
@@ -46,7 +47,9 @@ def _get_base(args: Sequence[str]) -> tuple[int, ToxHandler, Source]:
4647
tox_parser = ToxParser.base()
4748
parsed = Parsed()
4849
try:
49-
with Path(os.devnull).open("w") as file_handler, redirect_stderr(file_handler):
50+
with Path(os.devnull).open(
51+
"w", encoding=locale.getpreferredencoding(do_setlocale=False)
52+
) as file_handler, redirect_stderr(file_handler):
5053
tox_parser.parse_known_args(args, namespace=parsed)
5154
except SystemExit:
5255
... # ignore parse errors, such as -va raises ignored explicit argument 'a'

src/tox/config/cli/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def get_type(action: Action) -> type[Any]:
6262
loc = locals()
6363
loc["Literal"] = Literal
6464
as_literal = f"Literal[{', '.join(repr(i) for i in action.choices)}]"
65-
of_type = eval(as_literal, globals(), loc) # noqa: PGH001, S307
65+
of_type = eval(as_literal, globals(), loc) # noqa: S307
6666
elif action.default is not None:
6767
of_type = type(action.default)
6868
elif isinstance(action, argparse._StoreConstAction) and action.const is not None: # noqa: SLF001

src/tox/journal/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
import json
6+
import locale
67
from pathlib import Path
78

89
from .env import EnvJournal
@@ -12,7 +13,7 @@
1213
def write_journal(path: Path | None, journal: Journal) -> None:
1314
if path is None:
1415
return
15-
with Path(path).open("w") as file_handler:
16+
with Path(path).open("w", encoding=locale.getpreferredencoding(do_setlocale=False)) as file_handler:
1617
json.dump(journal.content, file_handler, indent=2, ensure_ascii=False)
1718

1819

src/tox/provision.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
import json
6+
import locale
67
import logging
78
import sys
89
from importlib.metadata import PackageNotFoundError, distribution
@@ -116,7 +117,9 @@ def add_tox_requires_min_version(reqs: list[Requirement]) -> list[Requirement]:
116117
"minversion": min_version[1] if len(min_version) >= 2 else None, # noqa: PLR2004
117118
"requires": [str(i) for i in requires],
118119
}
119-
Path(no_provision).write_text(json.dumps(requires_dict, indent=4))
120+
Path(no_provision).write_text(
121+
json.dumps(requires_dict, indent=4), encoding=locale.getpreferredencoding(do_setlocale=False)
122+
)
120123
raise HandledError(msg)
121124

122125
logging.warning("will run in automatically provisioned tox, host %s %s", sys.executable, miss_msg)

src/tox/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def run(args: Sequence[str] | None = None) -> None:
1818
try:
1919
with ToxHandler.patch_thread():
2020
result = main(sys.argv[1:] if args is None else args)
21-
except Exception as exception: # noqa: BLE001
21+
except Exception as exception:
2222
if isinstance(exception, HandledError):
2323
logging.error("%s| %s", type(exception).__name__, str(exception)) # noqa: TRY400
2424
result = -2

src/tox/session/cmd/run/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def update_spinner(self, result: ToxEnvRunResult, success: bool) -> None: # noq
229229
done(result.name)
230230

231231

232-
def _queue_and_wait( # noqa: C901, PLR0913, PLR0915
232+
def _queue_and_wait( # noqa: C901, PLR0913, PLR0915, PLR0912
233233
state: State,
234234
to_run_list: list[str],
235235
results: list[ToxEnvRunResult],

src/tox/session/cmd/run/single.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def _evaluate(tox_env: RunToxEnv, no_test: bool) -> tuple[bool, int, list[Outcom
5252
skipped = True
5353
except ToxBackendFailed as exception:
5454
LOGGER.error("%s", exception) # noqa: TRY400
55-
raise SystemExit(exception.code) # noqa: B904, TRY200
55+
raise SystemExit(exception.code) # noqa: B904
5656
except Fail as exception:
5757
LOGGER.error("failed with %s", exception) # noqa: TRY400
5858
code = 1

0 commit comments

Comments
 (0)