Skip to content

Commit

Permalink
Fix type-checking
Browse files Browse the repository at this point in the history
Update test typing for build 1.2.0 which has an explicit Distribution type.
  • Loading branch information
stefanor committed Apr 1, 2024
1 parent 08223fc commit 9585bc9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/3260.bugfix.rst
@@ -0,0 +1 @@
Update typing for build 1.2.0, which has an explicit ``Distribution`` type - by :user:`stefanor`.
5 changes: 3 additions & 2 deletions tests/conftest.py
Expand Up @@ -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
Expand Down Expand Up @@ -135,13 +136,13 @@ 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)
return next(dist_dir.iterdir())


@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

0 comments on commit 9585bc9

Please sign in to comment.