Improve typechecking of the test suite (#9806)

This commit is contained in:
Alex Waygood
2023-03-08 08:35:41 +00:00
committed by GitHub
parent bff9d7a7df
commit 8a2bc88409
4 changed files with 23 additions and 25 deletions

View File

@@ -14,6 +14,7 @@ ReturnCode: TypeAlias = int
SUPPORTED_PLATFORMS = ("linux", "darwin", "win32")
SUPPORTED_VERSIONS = ("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] = []
@@ -38,7 +39,7 @@ parser.add_argument(
choices=SUPPORTED_VERSIONS,
nargs="*",
action="extend",
help="Run mypy for certain Python versions (defaults to sys.version_info[:2])",
help=f"Run mypy for certain Python versions (defaults to {LOWEST_SUPPORTED_VERSION!r})",
)
@@ -77,7 +78,7 @@ def main() -> ReturnCode:
args = parser.parse_args()
directories = args.dir or DIRECTORIES_TO_TEST
platforms = args.platform or [sys.platform]
versions = args.python_version or [f"3.{sys.version_info[1]}"]
versions = args.python_version or [LOWEST_SUPPORTED_VERSION]
code = 0