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
+12 -5
View File
@@ -1,4 +1,5 @@
import textwrap
from pathlib import Path
import packaging.utils
import pytest
@@ -21,7 +22,7 @@ basic_project = test_projects.new_c_project(
@pytest.mark.serial
def test_dummy_serial():
def test_dummy_serial() -> None:
"""A no-op test to ensure that at least one serial test is always found.
Without this no-op test, CI fails on CircleCI because no serial tests are
@@ -29,7 +30,9 @@ def test_dummy_serial():
"""
def test(tmp_path, build_frontend_env, capfd):
def test(
tmp_path: Path, build_frontend_env: dict[str, str], capfd: pytest.CaptureFixture[str]
) -> None:
project_dir = tmp_path / "project"
basic_project.generate(project_dir)
@@ -52,7 +55,7 @@ def test(tmp_path, build_frontend_env, capfd):
@pytest.mark.skip(reason="to keep test output clean")
def test_sample_build(tmp_path, capfd):
def test_sample_build(tmp_path: Path, capfd: pytest.CaptureFixture[str]) -> None:
project_dir = tmp_path / "project"
basic_project.generate(project_dir)
@@ -70,7 +73,9 @@ def test_sample_build(tmp_path, capfd):
@pytest.mark.parametrize(
"enable_setting", ["", "cpython-prerelease", "pypy", "cpython-freethreading"]
)
def test_build_identifiers(tmp_path, enable_setting, monkeypatch):
def test_build_identifiers(
tmp_path: Path, enable_setting: str, monkeypatch: pytest.MonkeyPatch
) -> None:
project_dir = tmp_path / "project"
basic_project.generate(project_dir)
@@ -93,7 +98,9 @@ def test_build_identifiers(tmp_path, enable_setting, monkeypatch):
(None, {"CIBW_ALLOW_EMPTY": "1"}),
],
)
def test_allow_empty(tmp_path, add_args, env_allow_empty):
def test_allow_empty(
tmp_path: Path, add_args: list[str] | None, env_allow_empty: dict[str, str]
) -> None:
project_dir = tmp_path / "project"
basic_project.generate(project_dir)