mypy_test.py: rework filter, exclude and --dir arguments (#8711)

This commit is contained in:
Alex Waygood
2022-09-22 08:31:24 +01:00
committed by GitHub
parent b3db49abbd
commit 008fe2e764
3 changed files with 85 additions and 87 deletions

View File

@@ -1,12 +1,18 @@
"""Utilities that are imported by multiple scripts in the tests directory."""
import os
import re
from functools import cache
from pathlib import Path
from typing import NamedTuple
import tomli
def strip_comments(text: str) -> str:
return text.split("#")[0].strip()
try:
from termcolor import colored as colored
except ImportError:
@@ -46,6 +52,14 @@ def read_dependencies(distribution: str) -> tuple[str, ...]:
return tuple(dependencies)
# ====================================================================
# Parsing the stdlib/VERSIONS file
# ====================================================================
VERSIONS_RE = re.compile(r"^([a-zA-Z_][a-zA-Z0-9_.]*): ([23]\.\d{1,2})-([23]\.\d{1,2})?$")
# ====================================================================
# Getting test-case directories from package names
# ====================================================================