You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Simplify upgrade-pylib.md by removing manual copy steps handled by quick command
* Let upgrade-pylib run auto-mark instead marking manually
* Let upgrade-pylib a separate commit from updating module
* Correct commands' permissions
* Add open PR check to upgrade-pylib-next command
* Fix dependency pattern example in upgrade-pylib-next command
* Let upgrade-pylib command to invetigate failing tests
* Add pre-commit review to invetigate-test-failure command
* Use deps command to get dependent tests in upgrade-pylib workflow
- Copy library files (delete existing `Lib/$ARGUMENTS.py` or `Lib/$ARGUMENTS/`, then copy from `cpython/Lib/`)
38
36
- Patch test files preserving existing RustPython markers
39
37
- Run tests and auto-mark new test failures (not regressions)
40
38
- Remove `@unittest.expectedFailure` from tests that now pass
41
-
-**Handle warnings**: If you see warnings like `WARNING: TestCFoo does not exist in remote file`, it means the class structure changed and markers couldn't be transferred automatically. These need to be manually restored in step 4 or added in step 5.
39
+
- Create a git commit with the changes
40
+
-**Handle warnings**: If you see warnings like `WARNING: TestCFoo does not exist in remote file`, it means the class structure changed and markers couldn't be transferred automatically. These need to be manually restored in step 2 or added in step 3.
42
41
43
-
4.**Review git diff and restore RUSTPYTHON-specific changes**
42
+
2.**Review git diff and restore RUSTPYTHON-specific changes**
44
43
- Run `git diff Lib/test/test_$ARGUMENTS` to review all changes
45
44
-**Only restore changes that have explicit `RUSTPYTHON` comments**. Look for:
-**Class-specific markers**: If a test fails only in the C implementation (TestCFoo) but passes in the Python implementation (TestPyFoo), or vice versa, add the marker to the specific subclass, not the base class:
51
+
3.**Investigate test failures with subagent**
52
+
- First, get dependent tests using the deps command:
53
+
```
54
+
cargo run --release -- scripts/update_lib deps $ARGUMENTS
55
+
```
56
+
- Look for the line `- [ ] $ARGUMENTS: test_xxx test_yyy ...` to get the direct dependent tests
57
+
- Run those tests to collect failures:
58
+
```
59
+
cargo run --release -- -m test test_xxx test_yyy ... 2>&1 | grep -E "^(FAIL|ERROR):"
60
+
```
61
+
- For example, if deps output shows `- [ ] linecache: test_bdb test_inspect test_linecache test_traceback test_zipimport`, run:
62
+
```
63
+
cargo run --release -- -m test test_bdb test_inspect test_linecache test_traceback test_zipimport 2>&1 | grep -E "^(FAIL|ERROR):"
64
+
```
65
+
- For each failure, use the Task tool with `general-purpose` subagent to investigate:
66
+
- Subagent should follow the `/investigate-test-failure` skill workflow
67
+
- Pass the failed test identifier as the argument (e.g., `test_inspect.TestGetSourceBase.test_getsource_reload`)
68
+
- If subagent can fix the issue easily: fix and commit
69
+
- If complex issue: subagent collects issue info and reports back (issue creation on user request only)
70
+
- Using subagent prevents context pollution in the main conversation
71
+
72
+
4. **Mark remaining test failures with auto-mark**
- Or for directory: `python3 scripts/update_lib auto-mark Lib/test/test_$ARGUMENTS/ --mark-failure`
75
+
- This will:
76
+
- Run tests and mark ALL failing tests with `@unittest.expectedFailure`
77
+
- Remove `@unittest.expectedFailure` from tests that now pass
78
+
- **Note**: The `--mark-failure` flag marks all failures including regressions. Review the changes before committing.
79
+
80
+
5. **Handle panics manually**
81
+
- If any tests cause panics/crashes (not just assertion failures), they need `@unittest.skip` instead:
82
+
```python
83
+
@unittest.skip("TODO: RUSTPYTHON; panics with 'index out of bounds'")
84
+
def test_crashes(self):
85
+
...
86
+
```
87
+
- auto-mark cannot detect panics automatically - check the test output for crash messages
88
+
89
+
6. **Handle class-specific failures**
90
+
- If a test fails only in the C implementation (TestCFoo) but passes in the Python implementation (TestPyFoo), or vice versa, move the marker to the specific subclass:
59
91
```python
60
92
# Base class - no marker here
61
93
class TestFoo:
@@ -70,25 +102,21 @@ This helps improve the tooling for future upgrades.
70
102
def test_something(self):
71
103
return super().test_something()
72
104
```
73
-
-**New tests from CPython**: The upgrade may bring in entirely new tests that didn't exist before. These won't have anyRUSTPYTHON markers in the diff - they just need to be tested and marked if they fail.
74
-
- Example markers:
75
-
```python
76
-
#TODO: RUSTPYTHON
77
-
@unittest.expectedFailure
78
-
deftest_something(self):
79
-
...
80
105
81
-
#TODO: RUSTPYTHON
82
-
@unittest.skip("TODO: RUSTPYTHON; panics with 'index out of bounds'")
0 commit comments