diff --git a/scripts/update_lib/cmd_quick.py b/scripts/update_lib/cmd_quick.py index a56d8f57de8..319d4aeec3e 100644 --- a/scripts/update_lib/cmd_quick.py +++ b/scripts/update_lib/cmd_quick.py @@ -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 diff --git a/scripts/update_lib/deps.py b/scripts/update_lib/deps.py index e5187a85e7c..99fe5154620 100644 --- a/scripts/update_lib/deps.py +++ b/scripts/update_lib/deps.py @@ -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)