mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Bundle path handling in ts_utils.paths (#12805)
This commit is contained in:
@@ -22,9 +22,9 @@ from pathlib import Path
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from ts_utils.metadata import get_recursive_requirements, read_metadata
|
||||
from ts_utils.paths import STDLIB_PATH, TEST_CASES_DIR, TS_BASE_PATH, distribution_path
|
||||
from ts_utils.utils import (
|
||||
PYTHON_VERSION,
|
||||
TEST_CASES_DIR,
|
||||
DistributionTests,
|
||||
colored,
|
||||
distribution_info,
|
||||
@@ -134,14 +134,14 @@ def setup_testcase_dir(package: DistributionTests, tempdir: Path, verbosity: Ver
|
||||
# that has only the required stubs copied over.
|
||||
new_typeshed = tempdir / TYPESHED
|
||||
new_typeshed.mkdir()
|
||||
shutil.copytree(Path("stdlib"), new_typeshed / "stdlib")
|
||||
shutil.copytree(STDLIB_PATH, new_typeshed / "stdlib")
|
||||
requirements = get_recursive_requirements(package.name)
|
||||
# mypy refuses to consider a directory a "valid typeshed directory"
|
||||
# unless there's a stubs/mypy-extensions path inside it,
|
||||
# so add that to the list of stubs to copy over to the new directory
|
||||
typeshed_requirements = [r.name for r in requirements.typeshed_pkgs]
|
||||
for requirement in {package.name, *typeshed_requirements, "mypy-extensions"}:
|
||||
shutil.copytree(Path("stubs", requirement), new_typeshed / "stubs" / requirement)
|
||||
shutil.copytree(distribution_path(requirement), new_typeshed / "stubs" / requirement)
|
||||
|
||||
if requirements.external_pkgs:
|
||||
venv_location = str(tempdir / VENV_DIR)
|
||||
@@ -190,7 +190,7 @@ def run_testcases(
|
||||
|
||||
if package.is_stdlib:
|
||||
python_exe = sys.executable
|
||||
custom_typeshed = Path(__file__).parent.parent
|
||||
custom_typeshed = TS_BASE_PATH
|
||||
flags.append("--no-site-packages")
|
||||
else:
|
||||
custom_typeshed = tempdir / TYPESHED
|
||||
|
||||
Reference in New Issue
Block a user