[update_lib] auto-mark original contents recovery by youknowone · Pull Request #6960 · RustPython/RustPython
📝 Walkthrough
Walkthrough
This PR adds crash recovery logic to auto-mark functionality that preserves and restores original test file contents when test runs crash or remain incomplete, preventing permanent loss of unittest markers during failed or partial test executions.
Changes
| Cohort / File(s) | Summary |
|---|---|
Auto-mark crash recovery implementation scripts/update_lib/cmd_auto_mark.py |
Added preservation of original file contents before marker stripping; restoration logic engages on test run failure, crash, or incomplete execution; per-file tracking of original content and stripped markers. |
Auto-mark crash recovery tests scripts/update_lib/tests/test_auto_mark.py |
Added test classes TestAutoMarkFileRestoresOnCrash and TestAutoMarkDirectoryRestoresOnCrash with scenarios verifying marker restoration after crashes and proper handling during complete test runs. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
- automark add reasons to reason-less expectedFailures and handles parent better #6936: Introduces per-file original content tracking and restoration on crash/incomplete runs that this PR extends and refines.
- Make auto-mark output deterministic and fix blank line leak #6957: Modifies the same
auto_mark_file/auto_mark_directoryfunctions for crash detection and extends failure handling logic.
Suggested labels
skip:ci
Suggested reviewers
- fanninpm
- ShaharNaveh
Poem
🐰 When tests do crash and markers fade,
A rabbit's code comes to the aid!
With restored contents, safe and sound,
Lost decorators are quickly found! ✨
🚥 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 'auto-mark original contents recovery' directly describes the main change: restoring original file contents during test auto-marking on crashes/incomplete runs. |
| Docstring Coverage | ✅ Passed | Docstring coverage is 100.00% 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.
Comment @coderabbitai help to get the list of available commands and usage tips.