Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#3226)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] committed Feb 22, 2024
1 parent c024fe2 commit 57783e3
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repos:
- id: pyproject-fmt
additional_dependencies: ["tox>=4.12.1"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.2.1"
rev: "v0.2.2"
hooks:
- id: ruff-format
- id: ruff
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ and `devpi <https://www.devpi.net>`_).
:target: https://pypistats.org/packages/tox
:alt: PyPI - Downloads
.. image:: https://img.shields.io/pypi/l/tox?style=flat-square
:target: https://opensource.org/license/mit/
:target: https://opensource.org/blog/license/mit
:alt: PyPI - License
.. image:: https://img.shields.io/github/issues/tox-dev/tox?style=flat-square
:target: https://github.com/tox-dev/tox/issues
Expand Down
2 changes: 1 addition & 1 deletion src/tox/config/loader/ini/replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def _replace_match(self, value: MatchExpression) -> str:
def _replace_ref(env: str | None) -> Pattern[str]:
return re.compile(
rf"""
(\[(?P<full_env>{re.escape(env or '.*')}(:(?P<env>[^]]+))?|(?P<section>[-\w]+))])? # env/section
(\[(?P<full_env>{re.escape(env or ".*")}(:(?P<env>[^]]+))?|(?P<section>[-\w]+))])? # env/section
(?P<key>[-a-zA-Z0-9_]+) # key
(:(?P<default>.*))? # default value
$
Expand Down
3 changes: 2 additions & 1 deletion src/tox/config/of_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ def __call__(
for key, loader in product(self.keys, loaders):
chain_key = f"{loader.section.key}.{key}"
if chain_key in args.chain:
msg = f"circular chain detected {', '.join(args.chain[args.chain.index(chain_key):])}"
values = args.chain[args.chain.index(chain_key) :]
msg = f"circular chain detected {', '.join(values)}"
raise ValueError(msg)
args.chain.append(chain_key)
try:
Expand Down
2 changes: 1 addition & 1 deletion src/tox/session/cmd/quickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def quickstart(state: State) -> int:
text = f"""
[tox]
env_list =
py{''.join(str(i) for i in sys.version_info[0:2])}
py{"".join(str(i) for i in sys.version_info[0:2])}
minversion = {version}
[testenv]
Expand Down
5 changes: 3 additions & 2 deletions src/tox/tox_env/python/pip/req_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,14 @@ def _normalize_line(line: str) -> str:
None,
)
if arg_match is not None:
line = f"{arg_match} {line[len(arg_match):]}"
values = line[len(arg_match) :]
line = f"{arg_match} {values}"
# escape spaces
escape_match = next((e for e in ONE_ARG_ESCAPE if line.startswith(e) and line[len(e)].isspace()), None)
if escape_match is not None:
# escape not already escaped spaces
escaped = re.sub(r"(?<!\\)(\s)", r"\\\1", line[len(escape_match) + 1 :])
line = f"{line[:len(escape_match)]} {escaped}"
line = f"{line[: len(escape_match)]} {escaped}"
return line

def _parse_requirements(self, opt: Namespace, recurse: bool) -> list[ParsedRequirement]: # noqa: FBT001
Expand Down
2 changes: 1 addition & 1 deletion tests/session/cmd/test_quickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_quickstart_ok(tox_project: ToxProjectCreator) -> None:
text = f"""
[tox]
env_list =
py{''.join(str(i) for i in sys.version_info[0:2])}
py{"".join(str(i) for i in sys.version_info[0:2])}
minversion = {version}
[testenv]
Expand Down
2 changes: 1 addition & 1 deletion tests/tox_env/python/pip/req/test_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def test_req_path_with_space_escape(tmp_path: Path) -> None:
dep_requirements_file = tmp_path / "a b"
dep_requirements_file.write_text("c")
path = f"-r {dep_requirements_file!s}"
path = f'{path[:-len("a b")]}a\\ b'
path = f'{path[: -len("a b")]}a\\ b'

requirements_file = tmp_path / "req.txt"
requirements_file.write_text(path)
Expand Down
2 changes: 1 addition & 1 deletion tests/tox_env/test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
def test_info_repr() -> None:
at_loc = Path().absolute()
info_object = Info(at_loc)
assert repr(info_object) == f"Info(path={ at_loc / '.tox-info.json' })"
assert repr(info_object) == f"Info(path={at_loc / '.tox-info.json'})"

0 comments on commit 57783e3

Please sign in to comment.