Skip to content

[update_lib] Fix async func auto-mark#6903

Merged
youknowone merged 3 commits intoRustPython:mainfrom
youknowone:automark
Jan 30, 2026
Merged

[update_lib] Fix async func auto-mark#6903
youknowone merged 3 commits intoRustPython:mainfrom
youknowone:automark

Conversation

@youknowone
Copy link
Member

@youknowone youknowone commented Jan 30, 2026

Summary by CodeRabbit

  • New Features

    • Async test support extended: automatic async wrapper generation and improved handling of inherited async/sync tests.
    • Detection and reporting of unexpected test-success cases.
  • Improvements

    • Parser now handles multiline test result formats and aggregates overall test results.
    • Better extraction of failure/error messages and handling of async super-call patterns.
  • Tests

    • Expanded unit tests covering multiline parsing, async super-calls, and inheritance cases.

✏️ Tip: You can customize this high-level summary in your review settings.

@youknowone youknowone marked this pull request as ready for review January 30, 2026 14:40
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 30, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Adds multiline test-result parsing, UNEXPECTED SUCCESS and error-message extraction, async super-call detection (including awaited super calls), and async-test tracking with generation of async wrappers during patch creation.

Changes

Cohort / File(s) Summary
Test parsing & super-call detection
scripts/update_lib/cmd_auto_mark.py
Adds _try_parse_test_info(); extends parse_results() to handle multiline test entries, pending test info, UNEXPECTED SUCCESS, and error-message extraction; updates _is_super_call_only() to unwrap Await for async methods.
Async-aware patch generation
scripts/update_lib/patch_spec.py
Adds async_methods detection (scans for AsyncFunctionDef) and emits async def wrappers (with await super()...) for async tests while preserving sync wrapper behavior and decorator handling.
Unit tests
scripts/update_lib/tests/test_auto_mark.py
Adds new tests (~+166 LOC) covering multiline parsing, UNEXPECTED SUCCESS handling, async super-call cases, and Phase 2 inherited-test wrapper generation for both async and sync tests.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • moreal
  • ShaharNaveh

Poem

🐰
I nibble through lines of test and thread,
Multiline whispers traced and read,
Awaiting super with a nimble hop,
Async wrappers ready — non-stop,
Hooray — the patch-carrot’s on the top!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title '[update_lib] Fix async func auto-mark' directly and clearly summarizes the main change: fixing async function handling in the auto-mark utility, which is the primary focus of all file modifications.
Docstring Coverage ✅ Passed Docstring coverage is 93.75% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

Code has been automatically formatted

The code in this PR has been formatted using:

  • ruff format
    Please pull the latest changes before pushing again:
git pull origin automark

Copy link
Contributor

@ShaharNaveh ShaharNaveh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@scripts/update_lib/patch_spec.py`:
- Around line 250-257: The async_methods set currently tracks only method names
(async_methods) causing incorrect async/signature detection; change
async_methods to record class+method context (e.g., store tuples like
(class_name, method_name) or a dict keyed by class name) when scanning AST (the
loop over tree.body that fills async_methods), and update the later check (where
is_async is computed from test_name) to look up using the class context (e.g.,
(current_class_name, test_name) or
async_methods[current_class_name].contains(test_name)) so async detection is
per-class rather than global.

@youknowone youknowone added the skip:ci Skip running the ci label Jan 30, 2026
@youknowone youknowone merged commit 528d657 into RustPython:main Jan 30, 2026
10 of 13 checks passed
@youknowone youknowone deleted the automark branch January 30, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip:ci Skip running the ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants