tests: fully type the test suite (#2794)

* tests: fully type the test suite

* chore: require more typing

Signed-off-by: Henry Schreiner <henryfs@princeton.edu>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Henry Schreiner
2026-04-01 15:23:02 +01:00
committed by GitHub
co-authored by pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
parent 643b30c796
commit 097806b6b1
58 changed files with 627 additions and 339 deletions
@@ -1,14 +1,17 @@
import sys
import textwrap
from pathlib import Path
import pytest
from packaging.specifiers import SpecifierSet
from cibuildwheel.__main__ import main
from .conftest import ArgsInterceptor
@pytest.fixture(autouse=True)
def fake_package_dir(monkeypatch, tmp_path):
def fake_package_dir(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> Path:
"""
Set up a fake project
"""
@@ -24,7 +27,7 @@ def fake_package_dir(monkeypatch, tmp_path):
@pytest.mark.usefixtures("platform")
def test_no_override(intercepted_build_args):
def test_no_override(intercepted_build_args: ArgsInterceptor) -> None:
main()
options = intercepted_build_args.args[0]
@@ -37,7 +40,9 @@ def test_no_override(intercepted_build_args):
@pytest.mark.usefixtures("platform")
def test_override_env(monkeypatch, intercepted_build_args):
def test_override_env(
monkeypatch: pytest.MonkeyPatch, intercepted_build_args: ArgsInterceptor
) -> None:
monkeypatch.setenv("CIBW_PROJECT_REQUIRES_PYTHON", ">=3.8")
main()
@@ -52,7 +57,9 @@ def test_override_env(monkeypatch, intercepted_build_args):
@pytest.mark.usefixtures("platform")
def test_override_setup_cfg(intercepted_build_args, fake_package_dir):
def test_override_setup_cfg(
intercepted_build_args: ArgsInterceptor, fake_package_dir: Path
) -> None:
fake_package_dir.joinpath("setup.cfg").write_text(
textwrap.dedent(
"""
@@ -74,7 +81,9 @@ def test_override_setup_cfg(intercepted_build_args, fake_package_dir):
@pytest.mark.usefixtures("platform")
def test_override_pyproject_toml(intercepted_build_args, fake_package_dir):
def test_override_pyproject_toml(
intercepted_build_args: ArgsInterceptor, fake_package_dir: Path
) -> None:
fake_package_dir.joinpath("pyproject.toml").write_text(
textwrap.dedent(
"""
@@ -96,7 +105,9 @@ def test_override_pyproject_toml(intercepted_build_args, fake_package_dir):
@pytest.mark.usefixtures("platform")
def test_override_setup_py_simple(intercepted_build_args, fake_package_dir):
def test_override_setup_py_simple(
intercepted_build_args: ArgsInterceptor, fake_package_dir: Path
) -> None:
fake_package_dir.joinpath("setup.py").write_text(
textwrap.dedent(
"""