Skip to content

Commit

Permalink
Merge branch 'main' into on-platform
Browse files Browse the repository at this point in the history
Signed-off-by: Bernát Gábor <[email protected]>
  • Loading branch information
gaborbernat committed Aug 5, 2024
2 parents 00ff1be + 2cf190a commit 73bd97e
Show file tree
Hide file tree
Showing 33 changed files with 53 additions and 50 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.6
rev: 0.29.1
hooks:
- id: check-github-workflows
args: [ "--verbose" ]
Expand All @@ -20,11 +20,11 @@ repos:
- id: tox-ini-fmt
args: ["-p", "fix"]
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "2.1.4"
rev: "2.2.1"
hooks:
- id: pyproject-fmt
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.5.0"
rev: "v0.5.6"
hooks:
- id: ruff-format
- id: ruff
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ lint.ignore = [
"D", # ignore documentation for now
"D203", # `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible
"D212", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible
"DOC201", # broken with sphinx docs
"DOC501", # broken with sphinx docs
"INP001", # no implicit namespaces here
"ISC001", # conflicts with formatter
"PLR0914", ## Too many local variables
Expand Down
2 changes: 1 addition & 1 deletion src/tox/config/cli/parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Customize argparse logic for tox (also contains the base options)."""
"""Customize argparse logic for tox (also contains the base options).""" # noqa: A005

from __future__ import annotations

Expand Down
4 changes: 2 additions & 2 deletions src/tox/config/loader/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __str__(self) -> str:
return f"{self.namespace}{'.' if self.namespace else ''}{self.key}={self.value}"

def __eq__(self, other: object) -> bool:
if type(self) != type(other):
if type(self) != type(other): # noqa: E721
return False
return (self.namespace, self.key, self.value) == (
other.namespace, # type: ignore[attr-defined]
Expand Down Expand Up @@ -112,7 +112,7 @@ def __repr__(self) -> str:
def __contains__(self, item: str) -> bool:
return item in self.found_keys()

def load( # noqa: PLR0913
def load(
self,
key: str,
of_type: type[V],
Expand Down
2 changes: 1 addition & 1 deletion src/tox/config/loader/ini/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
class IniLoader(StrConvert, Loader[str]):
"""Load configuration from an ini section (ini file is a string to string dictionary)."""

def __init__( # noqa: PLR0913
def __init__(
self,
section: Section,
parser: ConfigParser,
Expand Down
4 changes: 2 additions & 2 deletions src/tox/config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class Config:
"""Main configuration object for tox."""

def __init__( # noqa: PLR0913
def __init__(
self,
config_source: Source,
options: Parsed,
Expand Down Expand Up @@ -123,7 +123,7 @@ def core(self) -> CoreConfigSet:
self._core_set = core
return core

def get_section_config( # noqa: PLR0913
def get_section_config(
self,
section: Section,
base: list[str] | None,
Expand Down
6 changes: 3 additions & 3 deletions src/tox/config/of_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __call__(self, conf: Config, loaders: list[Loader[T]], args: ConfigLoadArgs)
raise NotImplementedError

def __eq__(self, o: object) -> bool:
return type(self) == type(o) and (self.keys, self.desc) == (o.keys, o.desc) # type: ignore[attr-defined]
return type(self) == type(o) and (self.keys, self.desc) == (o.keys, o.desc) # type: ignore[attr-defined] # noqa: E721

def __ne__(self, o: object) -> bool:
return not (self == o)
Expand All @@ -56,7 +56,7 @@ def __call__(
return self.value() if callable(self.value) else self.value

def __eq__(self, o: object) -> bool:
return type(self) == type(o) and super().__eq__(o) and self.value == o.value # type: ignore[attr-defined]
return type(self) == type(o) and super().__eq__(o) and self.value == o.value # type: ignore[attr-defined] # noqa: E721

def __repr__(self) -> str:
values = ((k, v) for k, v in vars(self).items() if v is not None)
Expand Down Expand Up @@ -120,7 +120,7 @@ def __repr__(self) -> str:

def __eq__(self, o: object) -> bool:
return (
type(self) == type(o)
type(self) == type(o) # noqa: E721
and super().__eq__(o)
and (self.of_type, self.default, self.post_process) == (o.of_type, o.default, o.post_process) # type: ignore[attr-defined]
)
Expand Down
6 changes: 3 additions & 3 deletions src/tox/config/types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import annotations
from __future__ import annotations # noqa: A005

from collections import OrderedDict
from typing import Iterator, Sequence
Expand Down Expand Up @@ -26,7 +26,7 @@ def __repr__(self) -> str:
return f"{type(self).__name__}(args={args!r})"

def __eq__(self, other: object) -> bool:
return type(self) == type(other) and (self.args, self.ignore_exit_code, self.invert_exit_code) == (
return type(self) == type(other) and (self.args, self.ignore_exit_code, self.invert_exit_code) == ( # noqa: E721
other.args, # type: ignore[attr-defined]
other.ignore_exit_code, # type: ignore[attr-defined]
other.invert_exit_code, # type: ignore[attr-defined]
Expand Down Expand Up @@ -56,7 +56,7 @@ def __repr__(self) -> str:
return f"{type(self).__name__}({self.envs!r})"

def __eq__(self, other: object) -> bool:
return type(self) == type(other) and self.envs == other.envs # type: ignore[attr-defined]
return type(self) == type(other) and self.envs == other.envs # type: ignore[attr-defined] # noqa: E721

def __ne__(self, other: object) -> bool:
return not (self == other)
Expand Down
2 changes: 1 addition & 1 deletion src/tox/execute/local_sub_process/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def interrupt(self) -> None: # noqa: PLR6301


class LocalSubProcessExecuteInstance(ExecuteInstance):
def __init__( # noqa: PLR0913
def __init__(
self,
request: ExecuteRequest,
options: ExecuteOptions,
Expand Down
2 changes: 1 addition & 1 deletion src/tox/execute/pep517_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def close(self) -> None:
class LocalSubProcessPep517ExecuteInstance(ExecuteInstance):
"""A backend invocation."""

def __init__( # noqa: PLR0913
def __init__(
self,
request: ExecuteRequest,
options: ExecuteOptions,
Expand Down
4 changes: 2 additions & 2 deletions src/tox/pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def interrupt(self) -> None: # noqa: PLR6301
return None # pragma: no cover

class MockExecuteInstance(ExecuteInstance):
def __init__( # noqa: PLR0913
def __init__(
self,
request: ExecuteRequest,
options: ExecuteOptions,
Expand Down Expand Up @@ -424,7 +424,7 @@ def _init(files: dict[str, Any], base: Path | None = None, prj_path: Path | None
return _init


@pytest.fixture()
@pytest.fixture
def empty_project(tox_project: ToxProjectCreator, monkeypatch: pytest.MonkeyPatch) -> ToxProject:
project = tox_project({"tox.ini": ""})
monkeypatch.chdir(project.path)
Expand Down
5 changes: 3 additions & 2 deletions src/tox/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
from contextlib import contextmanager
from io import BytesIO, TextIOWrapper
from pathlib import Path
from threading import Thread, current_thread, enumerate, local
from threading import Thread, current_thread, local
from threading import enumerate as enumerate_threads
from typing import IO, ClassVar, Iterator, Tuple

from colorama import Fore, Style, init
Expand Down Expand Up @@ -58,7 +59,7 @@ def name(self) -> str:
def name(self, value: str) -> None:
self._name = value

for ident in self._ident_to_data.keys() - {t.ident for t in enumerate()}:
for ident in self._ident_to_data.keys() - {t.ident for t in enumerate_threads()}:
self._ident_to_data.pop(ident)
self._ident_to_data[current_thread().ident] = value

Expand Down
2 changes: 1 addition & 1 deletion src/tox/session/env_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __repr__(self) -> str:
return f"{self.__class__.__name__}({'' if self.is_default_list else repr(str(self))})"

def __eq__(self, other: object) -> bool:
return type(self) == type(other) and self._names == other._names # type: ignore[attr-defined]
return type(self) == type(other) and self._names == other._names # type: ignore[attr-defined] # noqa: E721

def __ne__(self, other: object) -> bool:
return not (self == other)
Expand Down
2 changes: 1 addition & 1 deletion src/tox/tox_env/python/pip/req/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def as_args(self) -> Iterator[str]:


class ParsedLine:
def __init__( # noqa: PLR0913
def __init__(
self,
filename: str,
lineno: int,
Expand Down
2 changes: 1 addition & 1 deletion src/tox/tox_env/python/virtual_env/package/pyproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ def _send_msg(
if self._tox_env.conf["fresh_subprocess"]:
self.backend_executor.close()

def _unexpected_response( # noqa: PLR0913
def _unexpected_response(
self,
cmd: str,
got: Any,
Expand Down
2 changes: 1 addition & 1 deletion src/tox/util/spinner.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Spinner:
UNICODE_OUTCOME = Outcome(ok="✔", fail="✖", skip="⚠")
ASCII_OUTCOME = Outcome(ok="+", fail="!", skip="?")

def __init__( # noqa: PLR0913
def __init__(
self,
enabled: bool = True, # noqa: FBT001, FBT002
refresh_rate: float = 0.1,
Expand Down
2 changes: 1 addition & 1 deletion tests/config/cli/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from tox.session.state import State


@pytest.fixture()
@pytest.fixture
def core_handlers() -> dict[str, Callable[[State], int]]:
return {
"config": show_config,
Expand Down
4 changes: 2 additions & 2 deletions tests/config/cli/test_cli_ini.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from tox.session.state import State


@pytest.fixture()
@pytest.fixture
def default_options() -> dict[str, Any]:
return {
"colored": "no",
Expand Down Expand Up @@ -168,7 +168,7 @@ def test_conf_arg(tmp_path: Path, conf_arg: str, filename: str, content: str) ->
)


@pytest.fixture()
@pytest.fixture
def exhaustive_ini(tmp_path: Path, monkeypatch: MonkeyPatch) -> Path:
to = tmp_path / "tox.ini"
to.write_text(
Expand Down
2 changes: 1 addition & 1 deletion tests/config/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
from tox.config.main import Config


@pytest.fixture()
@pytest.fixture
def empty_config(tox_ini_conf: ToxIniCreator) -> Config:
return tox_ini_conf("")
2 changes: 1 addition & 1 deletion tests/config/loader/ini/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from pathlib import Path


@pytest.fixture()
@pytest.fixture
def mk_ini_conf(tmp_path: Path) -> Callable[[str], ConfigParser]:
def _func(raw: str) -> ConfigParser:
filename = tmp_path / "demo.ini"
Expand Down
2 changes: 1 addition & 1 deletion tests/config/loader/ini/replace/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ReplaceOne(Protocol):
def __call__(self, conf: str, pos_args: list[str] | None = None) -> str: ...


@pytest.fixture()
@pytest.fixture
def replace_one(tmp_path: Path) -> ReplaceOne:
def example(conf: str, pos_args: list[str] | None = None) -> str:
tox_ini_file = tmp_path / "tox.ini"
Expand Down
2 changes: 1 addition & 1 deletion tests/config/loader/ini/replace/test_replace_env_var.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def test_replace_env_var_circular(replace_one: ReplaceOne, monkeypatch: MonkeyPa
assert result == "{env:MAGIC}"


@pytest.fixture()
@pytest.fixture
def reset_env_var_after_delay(monkeypatch: MonkeyPatch) -> Generator[threading.Thread, None, None]:
timeout = 2

Expand Down
2 changes: 1 addition & 1 deletion tests/config/loader/ini/replace/test_replace_tox_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
EnvConfigCreator = Callable[[str], ConfigSet]


@pytest.fixture()
@pytest.fixture
def example(tox_ini_conf: ToxIniCreator) -> EnvConfigCreator:
def func(conf: str) -> ConfigSet:
config = tox_ini_conf(f"""[tox]\nenv_list = a\n[testenv]\n{conf}\n""")
Expand Down
2 changes: 1 addition & 1 deletion tests/config/test_set_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __call__(
) -> SetEnv: ...


@pytest.fixture()
@pytest.fixture
def eval_set_env(tox_project: ToxProjectCreator) -> EvalSetEnv:
def func(tox_ini: str, extra_files: dict[str, Any] | None = None, from_cwd: Path | None = None) -> SetEnv:
prj = tox_project({"tox.ini": tox_ini, **(extra_files or {})})
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ToxIniCreator(Protocol):
def __call__(self, conf: str, override: Sequence[Override] | None = None) -> Config: ...


@pytest.fixture()
@pytest.fixture
def tox_ini_conf(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> ToxIniCreator:
def func(conf: str, override: Sequence[Override] | None = None) -> Config:
dest = tmp_path / "c"
Expand Down Expand Up @@ -78,7 +78,7 @@ def demo_pkg_inline() -> Iterator[Path]:
yield demo_path


@pytest.fixture()
@pytest.fixture
def patch_prev_py(mocker: MockerFixture) -> Callable[[bool], tuple[str, str]]:
def _func(has_prev: bool) -> tuple[str, str]:
ver = sys.version_info[0:2]
Expand Down
2 changes: 1 addition & 1 deletion tests/journal/test_main_journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from tox.journal.main import Journal


@pytest.fixture()
@pytest.fixture
def base_info() -> dict[str, Any]:
return {
"reportversion": "1",
Expand Down
2 changes: 1 addition & 1 deletion tests/session/cmd/test_devenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_devenv_fail_multiple_target(tox_project: ToxProjectCreator) -> None:
outcome.assert_out_err(msg, "")


@pytest.mark.integration()
@pytest.mark.integration
def test_devenv_ok(tox_project: ToxProjectCreator, enable_pip_pypi_access: str | None) -> None: # noqa: ARG001
content = {
"setup.py": "from setuptools import setup\nsetup(name='demo', version='1.0')",
Expand Down
2 changes: 1 addition & 1 deletion tests/session/cmd/test_list_envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from tox.pytest import ToxProject, ToxProjectCreator


@pytest.fixture()
@pytest.fixture
def project(tox_project: ToxProjectCreator) -> ToxProject:
ini = """
[tox]
Expand Down
4 changes: 2 additions & 2 deletions tests/session/cmd/test_sequential.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_run_sequential_quiet(tox_project: ToxProjectCreator) -> None:
assert Matches(r" a: OK \([\d.]+ seconds\)") == reports[-2]


@pytest.mark.integration()
@pytest.mark.integration
def test_result_json_sequential(
tox_project: ToxProjectCreator,
enable_pip_pypi_access: str | None, # noqa: ARG001
Expand Down Expand Up @@ -156,7 +156,7 @@ def test_rerun_sequential_wheel(tox_project: ToxProjectCreator, demo_pkg_inline:
result_rerun.assert_success()


@pytest.mark.integration()
@pytest.mark.integration
def test_rerun_sequential_sdist(tox_project: ToxProjectCreator, demo_pkg_inline: Path) -> None:
proj = tox_project(
{"tox.ini": "[testenv]\npackage=sdist\ncommands=python -c 'from demo_pkg_inline import do; do()'"},
Expand Down
Loading

0 comments on commit 73bd97e

Please sign in to comment.