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
+7 -6
View File
@@ -3,6 +3,7 @@ import os
import subprocess
import sys
import textwrap
from pathlib import Path
import pytest
@@ -48,7 +49,7 @@ if __name__ == "__main__":
@pytest.mark.parametrize("use_pyproject_toml", [True, False])
def test_pyodide_build(tmp_path, use_pyproject_toml):
def test_pyodide_build(tmp_path: Path, use_pyproject_toml: bool) -> None:
if sys.platform == "win32":
pytest.skip("pyodide-build doesn't work correctly on Windows")
@@ -88,7 +89,7 @@ def test_pyodide_build(tmp_path, use_pyproject_toml):
assert set(actual_wheels) == set(expected_wheels)
def test_pyodide_version_incompatible(tmp_path, capfd):
def test_pyodide_version_incompatible(tmp_path: Path, capfd: pytest.CaptureFixture[str]) -> None:
if sys.platform == "win32":
pytest.skip("pyodide-build doesn't work correctly on Windows")
@@ -110,19 +111,19 @@ def test_pyodide_version_incompatible(tmp_path, capfd):
@pytest.mark.parametrize("expect_failure", [True, False])
def test_pyodide_build_and_test(tmp_path, expect_failure):
def test_pyodide_build_and_test(tmp_path: Path, expect_failure: bool) -> None:
if sys.platform == "win32":
pytest.skip("pyodide-build doesn't work correctly on Windows")
if expect_failure:
basic_project.files["test/spam_test.py"] = textwrap.dedent(r"""
def test_filter():
def test_filter() -> None:
assert 0 == 1
""")
else:
basic_project.files["test/spam_test.py"] = textwrap.dedent(r"""
import spam
def test_filter():
def test_filter() -> None:
assert spam.filter("spam") == 0
""")
basic_project.generate(tmp_path)
@@ -149,7 +150,7 @@ def test_pyodide_build_and_test(tmp_path, expect_failure):
assert set(actual_wheels) == set(expected_wheels)
def test_pyodide_repair_wheel(tmp_path):
def test_pyodide_repair_wheel(tmp_path: Path) -> None:
if sys.platform == "win32":
pytest.skip("pyodide-build doesn't work correctly on Windows")