diff --git a/pyproject.toml b/pyproject.toml index 5d27e0bbd..adcd26252 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -147,7 +147,7 @@ extra-standard-library = [ "opcode", "pyexpat", ] -known-first-party = ["parse_metadata", "utils"] +known-first-party = ["_metadata", "_utils"] [tool.typeshed] oldest_supported_python = "3.8" diff --git a/scripts/stubsabot.py b/scripts/stubsabot.py index fc034289a..1fe972816 100644 --- a/scripts/stubsabot.py +++ b/scripts/stubsabot.py @@ -305,7 +305,7 @@ async def get_github_repo_info(session: aiohttp.ClientSession, stub_info: StubIn Else, return None. """ if stub_info.upstream_repository: - # We have various sanity checks for the upstream_repository field in tests/parse_metadata.py, + # We have various sanity checks for the upstream_repository field in tests/_metadata.py, # so no need to repeat all of them here split_url = urllib.parse.urlsplit(stub_info.upstream_repository) if split_url.netloc == "github.com": diff --git a/tests/parse_metadata.py b/tests/_metadata.py similarity index 99% rename from tests/parse_metadata.py rename to tests/_metadata.py index f843d103c..dbfd66d3e 100644 --- a/tests/parse_metadata.py +++ b/tests/_metadata.py @@ -2,6 +2,7 @@ # pyright: reportUnknownVariableType=false, reportUnknownArgumentType=false """Tools to help parse and validate information stored in METADATA.toml files.""" + from __future__ import annotations import os @@ -18,7 +19,7 @@ from packaging.requirements import Requirement from packaging.specifiers import Specifier from packaging.version import Version -from utils import cache +from _utils import cache __all__ = [ "NoSuchStubError", diff --git a/tests/utils.py b/tests/_utils.py similarity index 100% rename from tests/utils.py rename to tests/_utils.py diff --git a/tests/check_typeshed_structure.py b/tests/check_typeshed_structure.py index 3e4d6ed8d..74d1c3980 100755 --- a/tests/check_typeshed_structure.py +++ b/tests/check_typeshed_structure.py @@ -12,8 +12,8 @@ import re import sys from pathlib import Path -from parse_metadata import read_metadata -from utils import ( +from _metadata import read_metadata +from _utils import ( REQS_FILE, STDLIB_PATH, TEST_CASES_DIR, diff --git a/tests/get_external_stub_requirements.py b/tests/get_external_stub_requirements.py index cea368cce..5d910635f 100644 --- a/tests/get_external_stub_requirements.py +++ b/tests/get_external_stub_requirements.py @@ -4,7 +4,7 @@ from __future__ import annotations import os import sys -from parse_metadata import read_dependencies +from _metadata import read_dependencies distributions = sys.argv[1:] if not distributions: diff --git a/tests/get_stubtest_system_requirements.py b/tests/get_stubtest_system_requirements.py index 620399249..d32f2ae32 100644 --- a/tests/get_stubtest_system_requirements.py +++ b/tests/get_stubtest_system_requirements.py @@ -2,7 +2,7 @@ import os import sys -from parse_metadata import read_stubtest_settings +from _metadata import read_stubtest_settings platform = sys.platform distributions = sys.argv[1:] diff --git a/tests/mypy_test.py b/tests/mypy_test.py index a603bd524..925478978 100755 --- a/tests/mypy_test.py +++ b/tests/mypy_test.py @@ -26,8 +26,8 @@ from typing_extensions import Annotated, TypeAlias import tomli -from parse_metadata import PackageDependencies, get_recursive_requirements, read_metadata -from utils import ( +from _metadata import PackageDependencies, get_recursive_requirements, read_metadata +from _utils import ( PYTHON_VERSION, TESTS_DIR, VERSIONS_RE as VERSION_LINE_RE, @@ -202,7 +202,7 @@ def add_configuration(configurations: list[MypyDistConf], distribution: str) -> with Path("stubs", distribution, "METADATA.toml").open("rb") as f: data = tomli.load(f) - # TODO: This could be added to parse_metadata.py, but is currently unused + # TODO: This could be added to _metadata.py, but is currently unused mypy_tests_conf: dict[str, dict[str, Any]] = data.get("mypy-tests", {}) if not mypy_tests_conf: return diff --git a/tests/pyright_test.py b/tests/pyright_test.py index 45306530a..f6ff93fe1 100755 --- a/tests/pyright_test.py +++ b/tests/pyright_test.py @@ -6,7 +6,7 @@ import subprocess import sys from pathlib import Path -from utils import parse_requirements, print_command +from _utils import parse_requirements, print_command _WELL_KNOWN_FILE = Path("tests", "pyright_test.py") diff --git a/tests/pytype_test.py b/tests/pytype_test.py index ee314f3f0..a237e9772 100755 --- a/tests/pytype_test.py +++ b/tests/pytype_test.py @@ -24,7 +24,7 @@ from collections.abc import Iterable, Sequence from packaging.requirements import Requirement -from parse_metadata import read_dependencies +from _metadata import read_dependencies if sys.platform == "win32": print("pytype does not support Windows.", file=sys.stderr) diff --git a/tests/regr_test.py b/tests/regr_test.py index 144e822f6..f8a3601ec 100755 --- a/tests/regr_test.py +++ b/tests/regr_test.py @@ -21,8 +21,8 @@ from functools import partial from pathlib import Path from typing_extensions import TypeAlias -from parse_metadata import get_recursive_requirements, read_metadata -from utils import ( +from _metadata import get_recursive_requirements, read_metadata +from _utils import ( PYTHON_VERSION, TEST_CASES_DIR, DistributionTests, diff --git a/tests/runtests.py b/tests/runtests.py index b465bf6c0..d242169c3 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -10,7 +10,7 @@ import sys from pathlib import Path from typing import Any -from utils import TEST_CASES_DIR, test_cases_path +from _utils import TEST_CASES_DIR, test_cases_path try: from termcolor import colored # pyright: ignore[reportAssignmentType] diff --git a/tests/stubtest_stdlib.py b/tests/stubtest_stdlib.py index 3bdb651cd..738759d81 100755 --- a/tests/stubtest_stdlib.py +++ b/tests/stubtest_stdlib.py @@ -13,7 +13,7 @@ import subprocess import sys from pathlib import Path -from utils import allowlist_stubtest_arguments, allowlists_path +from _utils import allowlist_stubtest_arguments, allowlists_path def run_stubtest(typeshed_dir: Path) -> int: diff --git a/tests/stubtest_third_party.py b/tests/stubtest_third_party.py index f2e4680d8..65877e9f7 100755 --- a/tests/stubtest_third_party.py +++ b/tests/stubtest_third_party.py @@ -12,8 +12,8 @@ from pathlib import Path from textwrap import dedent from typing import NoReturn -from parse_metadata import NoSuchStubError, get_recursive_requirements, read_metadata -from utils import ( +from _metadata import NoSuchStubError, get_recursive_requirements, read_metadata +from _utils import ( PYTHON_VERSION, allowlist_stubtest_arguments, allowlists_path, diff --git a/tests/typecheck_typeshed.py b/tests/typecheck_typeshed.py index 38e4a712b..d7e76d9d8 100755 --- a/tests/typecheck_typeshed.py +++ b/tests/typecheck_typeshed.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 """Run mypy on the "tests" and "scripts" directories.""" + from __future__ import annotations import argparse @@ -8,7 +9,7 @@ import sys from itertools import product from typing_extensions import TypeAlias -from utils import colored, print_error +from _utils import colored, print_error ReturnCode: TypeAlias = int