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 typecheck failures in master #2777

Merged
merged 3 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ module = [
"trio/_core/_tests/test_thread_cache",
"trio/_core/_tests/test_tutil",
"trio/_core/_tests/test_unbounded_queue",
"trio/_core/_tests/test_windows",
"trio/_core/_tests/tutil",
"trio/_tests/pytest_plugin",
"trio/_tests/test_abc",
Expand Down
15 changes: 11 additions & 4 deletions trio/_tests/check_type_completeness.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@
import json
import subprocess
import sys
from collections.abc import Mapping
from pathlib import Path

# the result file is not marked in MANIFEST.in so it's not included in the package
failed = False


def get_result_file_name(platform: str):
def get_result_file_name(platform: str) -> Path:
return Path(__file__).parent / f"verify_types_{platform.lower()}.json"


# TODO: consider checking manually without `--ignoreexternal`, and/or
# removing it from the below call later on.
def run_pyright(platform: str):
def run_pyright(platform: str) -> subprocess.CompletedProcess[bytes]:
return subprocess.run(
[
"pyright",
Expand All @@ -33,7 +34,13 @@ def run_pyright(platform: str):
)


def check_less_than(key, current_dict, last_dict, /, invert=False):
def check_less_than(
key: str,
current_dict: Mapping[str, object],
last_dict: Mapping[str, object],
/,
invert: bool = False,
) -> None:
global failed
current = current_dict[key]
last = last_dict[key]
Expand All @@ -57,7 +64,7 @@ def check_less_than(key, current_dict, last_dict, /, invert=False):
)


def check_zero(key, current_dict):
def check_zero(key: str, current_dict: Mapping[str, object]) -> None:
global failed
if current_dict[key] != 0:
failed = True
Expand Down