Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type-checking #3260

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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