8000 Run mypy and pyright on our py312 stubs in CI (#10119) · python/typeshed@2c34496 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2c34496

Browse files
authored
Run mypy and pyright on our py312 stubs in CI (#10119)
1 parent e0db6d2 commit 2c34496

File tree

7 files changed

+18
-9
lines changed

7 files changed

+18
-9
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
strategy:
8686
matrix:
8787
platform: ["linux", "win32", "darwin"]
88-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
88+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev"]
8989
fail-fast: false
9090
steps:
9191
- uses: actions/checkout@v3
@@ -116,7 +116,7 @@ jobs:
116116
strategy:
117117
matrix:
118118
python-platform: ["Linux", "Windows", "Darwin"]
119-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
119+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
120120
fail-fast: false
121121
steps:
122122
- uses: actions/checkout@v3

requirements-tests.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
aiohttp==3.8.4
1+
aiohttp==3.8.4; python_version < "3.12" # aiohttp can't be installed on 3.12 yet
22
black==23.3.0 # must match .pre-commit-config.yaml
33
flake8==6.0.0; python_version >= "3.8" # must match .pre-commit-config.yaml
44
flake8-bugbear==23.3.23; python_version >= "3.8" # must match .pre-commit-config.yaml

stdlib/configparser.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ __all__ = [
1717
"ParsingError",
1818
"MissingSectionHeaderError",
1919
"ConfigParser",
20-
"SafeConfigParser",
2120
"RawConfigParser",
2221
"Interpolation",
2322
"BasicInterpolation",
@@ -29,6 +28,9 @@ __all__ = [
2928
"MAX_INTERPOLATION_DEPTH",
3029
]
3130

31+
if sys.version_info < (3, 12):
32+
__all__ += ["SafeConfigParser"]
33+
3234
_Section: TypeAlias = Mapping[str, str]
3335
_Parser: TypeAlias = MutableMapping[str, _Section]
3436
_ConverterCallback: TypeAlias = Callable[[str], Any]

stdlib/itertools.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ if sys.version_info >= (3, 10):
272272
def __next__(self) -> _T_co: ...
273273

274274
if sys.version_info >= (3, 12):
275-
class batched(Iterator[_T_co], Generic[_T_co]):
275+
class batched(Iterator[tuple[_T_co, ...]], Generic[_T_co]):
276276
def __new__(cls, iterable: Iterable[_T_co], n: int) -> Self: ...
277277
def __iter__(self) -> Self: ...
278278
def __next__(self) -> tuple[_T_co, ...]: ...

tests/mypy_test.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
print_error("Cannot import mypy. Did you install it?")
4848
sys.exit(1)
4949

50-
SUPPORTED_VERSIONS = ["3.11", "3.10", "3.9", "3.8", "3.7"]
50+
SUPPORTED_VERSIONS = ["3.12", "3.11", "3.10", "3.9", "3.8", "3.7"]
5151
SUPPORTED_PLATFORMS = ("linux", "win32", "darwin")
5252
DIRECTORIES_TO_TEST = [Path("stdlib"), Path("stubs")]
5353

@@ -76,6 +76,13 @@ def valid_path(cmd_arg: str) -> Path:
7676
return path
7777

7878

79+
def remove_dev_suffix(version: str) -> str:
80+
"""Helper function for argument-parsing"""
81+
if version.endswith("-dev"):
82+
return version[: -len("-dev")]
83+
return version
84+
85+
7986
parser = argparse.ArgumentParser(
8087
description="Typecheck typeshed's stubs with mypy. Patterns are unanchored regexps on the full path."
8188
)
@@ -105,7 +112,7 @@ def __call__(
105112
parser.add_argument(
106113
"-p",
107114
"--python-version",
108-
type=str,
115+
type=remove_dev_suffix,
109116
choices=SUPPORTED_VERSIONS,
110117
nargs="*",
111118
action="extend",

tests/regr_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
TYPESHED = "typeshed"
3636

3737
SUPPORTED_PLATFORMS = ["linux", "darwin", "win32"]
38-
SUPPORTED_VERSIONS = ["3.11", "3.10", "3.9", "3.8", "3.7"]
38+
SUPPORTED_VERSIONS = ["3.12", "3.11", "3.10", "3.9", "3.8", "3.7"]
3939

4040

4141
def package_with_test_cases(package_name: str) -> PackageInfo:

tests/typecheck_typeshed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
ReturnCode: TypeAlias = int
1414

1515
SUPPORTED_PLATFORMS = ("linux", "darwin", "win32")
16-
SUPPORTED_VERSIONS = ("3.11", "3.10", "3.9")
16+
SUPPORTED_VERSIONS = ("3.12", "3.11", "3.10", "3.9")
1717
LOWEST_SUPPORTED_VERSION = min(SUPPORTED_VERSIONS, key=lambda x: int(x.split(".")[1]))
1818
DIRECTORIES_TO_TEST = ("scripts", "tests")
1919
EMPTY: list[str] = []

0 commit comments

Comments
 (0)
0