8000 Run mypy and pyright on our py312 stubs in CI by AlexWaygood · Pull Request #10119 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

Run mypy and pyright on our py312 stubs in CI #10119

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

Merged
merged 7 commits into from
Apr 30, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
10000
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
strategy:
matrix:
platform: ["linux", "win32", "darwin"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev"]
fail-fast: false
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
strategy:
matrix:
python-platform: ["Linux", "Windows", "Darwin"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
fail-fast: false
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion requirements-tests.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
aiohttp==3.8.4
aiohttp==3.8.4; python_version < "3.12" # aiohttp can't be installed on 3.12 yet
black==23.3.0 # must match .pre-commit-config.yaml
flake8==6.0.0; python_version >= "3.8" # must match .pre-commit-config.yaml
flake8-bugbear==23.3.23; python_version >= "3.8" # must match .pre-commit-config.yaml
Expand Down
4 changes: 3 additions & 1 deletion stdlib/configparser.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ __all__ = [
"ParsingError",
"MissingSectionHeaderError",
"ConfigParser",
"SafeConfigParser",
"RawConfigParser",
"Interpolation",
"BasicInterpolation",
Expand All @@ -29,6 +28,9 @@ __all__ = [
"MAX_INTERPOLATION_DEPTH",
]

if sys.version_info < (3, 12):
__all__ += ["SafeConfigParser"]

_Section: TypeAlias = Mapping[str, str]
_Parser: TypeAlias = MutableMapping[str, _Section]
_ConverterCallback: TypeAlias = Callable[[str], Any]
Expand Down
2 changes: 1 addition & 1 deletion stdlib/itertools.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ if sys.version_info >= (3, 10):
def __next__(self) -> _T_co: ...

if sys.version_info >= (3, 12):
class batched(Iterator[_T_co], Generic[_T_co]):
class batched(Iterator[tuple[_T_co, ...]], Generic[_T_co]):
def __new__(cls, iterable: Iterable[_T_co], n: int) -> Self: ...
def __iter__(self) -> Self: ...
def __next__(self) -> tuple[_T_co, ...]: ...
11 changes: 9 additions & 2 deletions tests/mypy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
print_error("Cannot import mypy. Did you install it?")
sys.exit(1)

SUPPORTED_VERSIONS = ["3.11", "3.10", "3.9", "3.8", "3.7"]
SUPPORTED_VERSIONS = ["3.12", "3.11", "3.10", "3.9", "3.8", "3.7"]
SUPPORTED_PLATFORMS = ("linux", "win32", "darwin")
DIRECTORIES_TO_TEST = [Path("stdlib"), Path("stubs")]

Expand Down Expand Up @@ -76,6 +76,13 @@ def valid_path(cmd_arg: str) -> Path:
return path


def remove_dev_suffix(version: str) -> str:
"""Helper function for argument-parsing"""
if version.endswith("-dev"):
return version[: -len("-dev")]
return version


parser = argparse.ArgumentParser(
description="Typecheck typeshed's stubs with mypy. Patterns are unanchored regexps on the full path."
)
Expand Down Expand Up @@ -105,7 +112,7 @@ def __call__(
parser.add_argument(
"-p",
"--python-version",
type=str,
type=remove_dev_suffix,
choices=SUPPORTED_VERSIONS,
nargs="*",
action="extend",
Expand Down
2 changes: 1 addition & 1 deletion tests/regr_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
TYPESHED = "typeshed"

SUPPORTED_PLATFORMS = ["linux", "darwin", "win32"]
SUPPORTED_VERSIONS = ["3.11", "3.10", "3.9", "3.8", "3.7"]
SUPPORTED_VERSIONS = ["3.12", "3.11", "3.10", "3.9", "3.8", "3.7"]


def package_with_test_cases(package_name: str) -> PackageInfo:
Expand Down
2 changes: 1 addition & 1 deletion tests/typecheck_typeshed.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
ReturnCode: TypeAlias = int

SUPPORTED_PLATFORMS = ("linux", "darwin", "win32")
SUPPORTED_VERSIONS = ("3.11", "3.10", "3.9")
SUPPORTED_VERSIONS = ("3.12", "3.11", "3.10", "3.9")
LOWEST_SUPPORTED_VERSION = min(SUPPORTED_VERSIONS, key=lambda x: int(x.split(".")[1]))
DIRECTORIES_TO_TEST = ("scripts", "tests")
EMPTY: list[str] = []
Expand Down
0