Skip to content

Commit

Permalink
Fix type-checking (#3260)
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 authored Apr 2, 2024
1 parent 08223fc commit a22fe8f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/changelog/3260.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update test typing for build 1.2.0, which has an explicit ``Distribution`` type - by :user:`stefanor`.
5 changes: 3 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from tox.tox_env.python.virtual_env.api import VirtualEnv

if TYPE_CHECKING:
from build import DistributionType
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[DistributionType], 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[DistributionType], bool], Path]:
return build_pkg

0 comments on commit a22fe8f

Please sign in to comment.