chore: stricter mypy checking

This commit is contained in:
Henry Fredrick Schreiner
2021-06-12 14:02:06 -04:00
parent 3311a36e65
commit 0aac8c2221
6 changed files with 27 additions and 28 deletions
+1 -1
View File
@@ -62,7 +62,7 @@ class Project:
print(f"Broken: {self.stars_repo}") print(f"Broken: {self.stars_repo}")
raise raise
self.num_stars = repo.stargazers_count self.num_stars: int = repo.stargazers_count
self.pushed_at = repo.pushed_at self.pushed_at = repo.pushed_at
if not self.notes: if not self.notes:
notes = repo.description notes = repo.description
+3 -3
View File
@@ -122,7 +122,7 @@ class PyPyVersions:
self.arch = arch_str self.arch = arch_str
def get_arch_file(self, release: dict[str, Any]) -> str: def get_arch_file(self, release: dict[str, Any]) -> str:
urls = [ urls: list[str] = [
rf["download_url"] rf["download_url"]
for rf in release["files"] for rf in release["files"]
if "" in rf["platform"] == f"win{self.arch}" if "" in rf["platform"] == f"win{self.arch}"
@@ -131,7 +131,7 @@ class PyPyVersions:
def update_version_windows(self, spec: Specifier) -> ConfigWinCP: def update_version_windows(self, spec: Specifier) -> ConfigWinCP:
releases = [r for r in self.releases if spec.contains(r["python_version"])] releases = [r for r in self.releases if spec.contains(r["python_version"])]
releases = sorted(releases, key=lambda r: r["pypy_version"]) releases = sorted(releases, key=lambda r: r["pypy_version"]) # type: ignore
releases = [r for r in releases if self.get_arch_file(r)] releases = [r for r in releases if self.get_arch_file(r)]
if not releases: if not releases:
@@ -156,7 +156,7 @@ class PyPyVersions:
raise RuntimeError("Other archs not supported yet on macOS") raise RuntimeError("Other archs not supported yet on macOS")
releases = [r for r in self.releases if spec.contains(r["python_version"])] releases = [r for r in self.releases if spec.contains(r["python_version"])]
releases = sorted(releases, key=lambda r: r["pypy_version"]) releases = sorted(releases, key=lambda r: r["pypy_version"]) # type: ignore
if not releases: if not releases:
raise RuntimeError(f"PyPy macOS {self.arch} not found for {spec}!") raise RuntimeError(f"PyPy macOS {self.arch} not found for {spec}!")
+16 -20
View File
@@ -18,6 +18,7 @@ multi_line_output = 3
[tool.pytest.ini_options] [tool.pytest.ini_options]
minversion = 6.0
junit_family = "xunit2" junit_family = "xunit2"
testpaths = [ testpaths = [
"test", "test",
@@ -26,7 +27,6 @@ testpaths = [
[tool.mypy] [tool.mypy]
minversion = 6.0
python_version = 3.7 python_version = 3.7
files = [ files = [
"cibuildwheel/*.py", "cibuildwheel/*.py",
@@ -36,33 +36,29 @@ files = [
] ]
warn_unused_configs = true warn_unused_configs = true
warn_redundant_casts = true warn_redundant_casts = true
# Don't require typed functions for tests
[[tool.mypy.overrides]]
module = ["test", "unit_test"]
check_untyped_defs = true
[[tool.mypy.overrides]]
module = "cibuildwheel"
disallow_any_generics = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
no_implicit_optional = true
warn_unused_ignores = true
warn_return_any = true
no_implicit_reexport = true no_implicit_reexport = true
strict_equality = true strict_equality = true
warn_unused_ignores = true
check_untyped_defs = true
disallow_subclassing_any = true
disallow_any_generics = true
warn_return_any = true
no_implicit_optional = true
[[tool.mypy.overrides]]
module = "cibuildwheel.*"
disallow_untyped_defs = true
disallow_untyped_calls = true
disallow_incomplete_defs = true
disallow_untyped_decorators = true
[[tool.mypy.overrides]] [[tool.mypy.overrides]]
module = [ module = [
"setuptools", "setuptools",
"pytest", # ignored in pre-commit to speed up check "pytest", # ignored in pre-commit to speed up check
"bashlex", "bashlex",
"toml.encoder", # missing from stub package "toml.encoder", # encoder missing from stub package
"bracex", "bracex",
"importlib_resources", "importlib_resources",
"nox", "nox",
+4 -2
View File
@@ -1,2 +1,4 @@
from .base import TestProject # noqa from .base import TestProject
from .c import new_c_project # noqa from .c import new_c_project
__all__ = ("TestProject", "new_c_project")
+2 -2
View File
@@ -11,7 +11,7 @@ def test_compare_configs():
dict_txt = toml.loads(txt) dict_txt = toml.loads(txt)
new_txt = toml.dumps(dict_txt, encoder=InlineArrayDictEncoder()) new_txt = toml.dumps(dict_txt, encoder=InlineArrayDictEncoder()) # type: ignore
print(new_txt) print(new_txt)
assert new_txt == txt assert new_txt == txt
@@ -35,6 +35,6 @@ python_configurations = [
] ]
""" """
output = toml.dumps(example, encoder=InlineArrayDictEncoder()) output = toml.dumps(example, encoder=InlineArrayDictEncoder()) # type: ignore
print(output) print(output)
assert output == result assert output == result
+1
View File
@@ -63,6 +63,7 @@ def test_container_removed():
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
universal_newlines=True, universal_newlines=True,
).stdout ).stdout
assert container.name is not None
assert container.name in docker_containers_listing assert container.name in docker_containers_listing
old_container_name = container.name old_container_name = container.name