Skip to content
Merged
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
fix async
  • Loading branch information
youknowone committed Jan 30, 2026
commit 54a34fb79bbe107f93c8ffe58a7a98c9b614760e
11 changes: 7 additions & 4 deletions scripts/update_lib/patch_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,17 @@ def _iter_patch_lines(

# Build cache of all classes (for Phase 2 to find classes without methods)
cache = {}
# Build set of async method names (for Phase 2 to generate correct override)
async_methods: set[str] = set()
# Build per-class set of async method names (for Phase 2 to generate correct override)
async_methods: dict[str, set[str]] = {}
for node in tree.body:
if isinstance(node, ast.ClassDef):
cache[node.name] = node.end_lineno
cls_async: set[str] = set()
for item in node.body:
if isinstance(item, ast.AsyncFunctionDef):
async_methods.add(item.name)
cls_async.add(item.name)
if cls_async:
async_methods[node.name] = cls_async

# Phase 1: Iterate and mark existing tests
for cls_node, fn_node in iter_tests(tree):
Expand All @@ -279,7 +282,7 @@ def _iter_patch_lines(

for test_name, specs in tests.items():
decorators = "\n".join(spec.as_decorator() for spec in specs)
is_async = test_name in async_methods
is_async = test_name in async_methods.get(cls_name, set())
if is_async:
patch_lines = f"""
{decorators}
Expand Down
Loading