[update_lib] fix hard_deps resolution and fix commit not to miss test data (#7058)

* [update_lib] fix hard_dep not to unclude other tests

* [update_lib] commit test data
This commit is contained in:
Jeong, YunWon
2026-02-09 14:41:15 +09:00
committed by GitHub
parent dc2d235e59
commit c974b77127
2 changed files with 22 additions and 14 deletions

View File

@@ -80,7 +80,7 @@ def quick(
mark_failure: bool = False,
verbose: bool = True,
skip_build: bool = False,
) -> None:
) -> list[pathlib.Path]:
"""
Process a file or directory: migrate + auto-mark.
@@ -91,10 +91,15 @@ def quick(
mark_failure: Add @expectedFailure to ALL failing tests
verbose: Print progress messages
skip_build: Skip cargo build, use pre-built binary
Returns:
List of extra paths (data dirs, hard deps) that were copied/migrated.
"""
from update_lib.cmd_auto_mark import auto_mark_directory, auto_mark_file
from update_lib.cmd_migrate import patch_directory, patch_file
extra_paths: list[pathlib.Path] = []
# Determine lib_path and whether to migrate
if is_lib_path(src_path):
no_migrate = True
@@ -128,6 +133,7 @@ def quick(
patch_directory(dep_src, dep_lib, verbose=False)
else:
patch_file(dep_src, dep_lib, verbose=False)
extra_paths.append(dep_lib)
# Copy data directories (no migration)
import shutil
@@ -146,6 +152,7 @@ def quick(
else:
data_lib.parent.mkdir(parents=True, exist_ok=True)
shutil.copy2(data_src, data_lib)
extra_paths.append(data_lib)
# Step 2: Auto-mark
if not no_auto_mark:
@@ -174,6 +181,8 @@ def quick(
print(f"Added expectedFailure to {num_added} tests")
print(f"Removed expectedFailure from {num_removed} tests")
return extra_paths
def get_cpython_version(cpython_dir: pathlib.Path) -> str:
"""Get CPython version from git tag."""
@@ -411,13 +420,14 @@ def main(argv: list[str] | None = None) -> int:
test_lib_path = parse_lib_path(test_src)
test_paths_for_commit.append(test_lib_path)
quick(
extra = quick(
test_src,
no_migrate=not args.migrate,
no_auto_mark=not args.auto_mark,
mark_failure=args.mark_failure,
skip_build=not args.build,
)
hard_deps_for_commit.extend(extra)
test_paths = test_paths_for_commit
else:
@@ -426,13 +436,14 @@ def main(argv: list[str] | None = None) -> int:
parse_lib_path(src_path) if not is_lib_path(src_path) else src_path
)
quick(
extra = quick(
src_path,
no_migrate=not args.migrate,
no_auto_mark=not args.auto_mark,
mark_failure=args.mark_failure,
skip_build=not args.build,
)
hard_deps_for_commit.extend(extra)
test_paths = [test_path]
# Step 3: Git commit

View File

@@ -1154,18 +1154,15 @@ def get_test_dependencies(
# Convert imports to paths (deps)
for imp in all_imports:
# Check if it's a test file (test_*) or support module
# Skip other test modules (test_*) - they are independently managed
# via their own update_lib entry. Only support/helper modules
# (e.g., string_tests, mapping_tests) should be treated as hard deps.
if imp.startswith("test_"):
# It's a test, resolve to test path
dep_path = test_path.parent / f"{imp}.py"
if not dep_path.exists():
dep_path = test_path.parent / imp
else:
# Support module like string_tests, lock_tests, encoded_modules
# Check file first, then directory
dep_path = test_path.parent / f"{imp}.py"
if not dep_path.exists():
dep_path = test_path.parent / imp
continue
dep_path = test_path.parent / f"{imp}.py"
if not dep_path.exists():
dep_path = test_path.parent / imp
if dep_path.exists() and dep_path not in result["hard_deps"]:
result["hard_deps"].append(dep_path)