From 9585bc93a0769b69079a02fb8c9298def8e3ab20 Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Mon, 1 Apr 2024 16:15:23 -0400 Subject: [PATCH] Fix type-checking Update test typing for build 1.2.0 which has an explicit Distribution type. --- docs/3260.bugfix.rst | 1 + tests/conftest.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 docs/3260.bugfix.rst diff --git a/docs/3260.bugfix.rst b/docs/3260.bugfix.rst new file mode 100644 index 000000000..2e4e9de98 --- /dev/null +++ b/docs/3260.bugfix.rst @@ -0,0 +1 @@ +Update typing for build 1.2.0, which has an explicit ``Distribution`` type - by :user:`stefanor`. diff --git a/tests/conftest.py b/tests/conftest.py index aca0c194b..70b2ec48d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -19,6 +19,7 @@ from tox.tox_env.python.virtual_env.api import VirtualEnv if TYPE_CHECKING: + from build._types import Distribution from pytest_mock import MockerFixture from tox.config.loader.api import Override @@ -135,7 +136,7 @@ def demo_pkg_inline_wheel(tmp_path_factory: pytest.TempPathFactory, demo_pkg_inl return build_pkg(tmp_path_factory.mktemp("dist"), demo_pkg_inline, ["wheel"]) -def build_pkg(dist_dir: Path, of: Path, distributions: list[str], isolation: bool = True) -> Path: +def build_pkg(dist_dir: Path, of: Path, distributions: Sequence[Distribution], isolation: bool = True) -> Path: from build.__main__ import build_package # noqa: PLC0415,PLC2701 build_package(str(of), str(dist_dir), distributions=distributions, isolation=isolation) @@ -143,5 +144,5 @@ def build_pkg(dist_dir: Path, of: Path, distributions: list[str], isolation: boo @pytest.fixture(scope="session") -def pkg_builder() -> Callable[[Path, Path, list[str], bool], Path]: +def pkg_builder() -> Callable[[Path, Path, Sequence[Distribution], bool], Path]: return build_pkg