Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Auto-format: ruff format
  • Loading branch information
github-actions[bot] authored and youknowone committed Jan 22, 2026
commit 38af152dcc4f961e1fb97b1fb62a7de6d6e35fd8
12 changes: 7 additions & 5 deletions scripts/update_lib/show_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ def format_deps(
consolidated = consolidate_test_paths(impacted_tests, test_dir)

if consolidated:
lines.append(f"[+] dependent tests: ({len(consolidated)} tests depend on {name})")
lines.append(
f"[+] dependent tests: ({len(consolidated)} tests depend on {name})"
)
for test_name in sorted(consolidated):
lines.append(f" - {test_name}")
else:
Expand Down Expand Up @@ -250,9 +252,7 @@ def show_deps(
for i, name in enumerate(expanded_names):
if i > 0:
print() # blank line between modules
for line in format_deps(
name, cpython_prefix, lib_prefix, max_depth, visited
):
for line in format_deps(name, cpython_prefix, lib_prefix, max_depth, visited):
print(line)


Expand Down Expand Up @@ -291,7 +291,9 @@ def main(argv: list[str] | None = None) -> int:
args = parser.parse_args(argv)

try:
show_deps(args.names, args.cpython, args.lib, args.depth, args.dependent_tests_only)
show_deps(
args.names, args.cpython, args.lib, args.depth, args.dependent_tests_only
)
return 0
except Exception as e:
print(f"Error: {e}", file=sys.stderr)
Expand Down
16 changes: 10 additions & 6 deletions scripts/update_lib/tests/test_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,9 @@ def test_module_directory_tests_consolidated(self):
(module_dir / "test_backup.py").write_text("# test")

result = consolidate_test_paths(
frozenset({module_dir / "test_dbapi.py", module_dir / "test_backup.py"}),
frozenset(
{module_dir / "test_dbapi.py", module_dir / "test_backup.py"}
),
test_dir,
)
self.assertEqual(result, frozenset({"test_sqlite3"}))
Expand All @@ -782,11 +784,13 @@ def test_mixed_top_level_and_module_directory(self):
(module_dir / "test_backup.py").write_text("# test")

result = consolidate_test_paths(
frozenset({
test_dir / "test_foo.py",
module_dir / "test_dbapi.py",
module_dir / "test_backup.py",
}),
frozenset(
{
test_dir / "test_foo.py",
module_dir / "test_dbapi.py",
module_dir / "test_backup.py",
}
),
test_dir,
)
self.assertEqual(result, frozenset({"test_foo", "test_sqlite3"}))
Expand Down