Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 22, 2024
1 parent e9b4dad commit bd352a3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/tox/session/cmd/show_config.py
Expand Up @@ -95,7 +95,7 @@ def print_key_value(is_colored: bool, key: str, value: str, multi_line: bool = F


def print_conf(is_colored: bool, conf: ConfigSet, keys: Iterable[str]) -> None: # noqa: FBT001
for key in keys if keys else conf:
for key in keys or conf:
if key not in conf:
continue
key = conf.primary_key(key) # noqa: PLW2901
Expand Down
3 changes: 2 additions & 1 deletion src/tox/tox_env/python/pip/pip_install.py
@@ -1,6 +1,7 @@
from __future__ import annotations

import logging
import operator
from collections import defaultdict
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, Sequence
Expand Down Expand Up @@ -132,7 +133,7 @@ def _install_requirement_file(self, arguments: PythonDeps, section: str, of_type
if not eq: # pragma: no branch
if old is not None:
self._recreate_if_diff("install flag(s)", new_options, old["options"], lambda i: i)
self._recreate_if_diff("constraint(s)", new_constraints, old["constraints"], lambda i: i[3:])
self._recreate_if_diff("constraint(s)", new_constraints, old["constraints"], operator.itemgetter(slice(3, None)))
missing_requirement = set(old["requirements"]) - set(new_requirements)
if missing_requirement:
msg = f"requirements removed: {' '.join(missing_requirement)}"
Expand Down
2 changes: 1 addition & 1 deletion src/tox/util/cpu.py
Expand Up @@ -10,7 +10,7 @@ def auto_detect_cpus() -> int:
n: int | None = multiprocessing.cpu_count()
except NotImplementedError:
n = None
return n if n else 1
return n or 1


__all__ = ("auto_detect_cpus",)
6 changes: 4 additions & 2 deletions tests/util/test_ci.py
@@ -1,5 +1,7 @@
from __future__ import annotations

import operator

import pytest

from tox.util.ci import _ENV_VARS, is_ci # noqa: PLC2701
Expand All @@ -22,7 +24,7 @@
"TEAMCITY_VERSION": None, # TeamCity
"TRAVIS": "true", # Travis CI
}.items(),
ids=lambda v: v[0],
ids=operator.itemgetter(0),
)
def test_is_ci(env_var: tuple[str, str | None], monkeypatch: pytest.MonkeyPatch) -> None:
for var in _ENV_VARS:
Expand All @@ -41,7 +43,7 @@ def test_is_ci(env_var: tuple[str, str | None], monkeypatch: pytest.MonkeyPatch)
"GITHUB_ACTIONS": "", # GitHub Actions
"TRAVIS": "", # Travis CI
}.items(),
ids=lambda v: v[0],
ids=operator.itemgetter(0),
)
def test_is_ci_bad_set(env_var: tuple[str, str], monkeypatch: pytest.MonkeyPatch) -> None:
for var in _ENV_VARS:
Expand Down

0 comments on commit bd352a3

Please sign in to comment.