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
- This will update the test files with basic RustPython markers (`@unittest.expectedFailure`, `@unittest.skip`, etc.)
29
+
- **Handle lib_updater warnings**: If you see warnings like `WARNING: TestCFoo does not exist in remote file`, it means the class structure changed between versions and markers couldn't be transferred automatically. These need to be manually restored in step 4 or added in step 5.
30
+
31
+
4. **Review git diff and restore RUSTPYTHON-specific changes**
32
+
- Run `git diff Lib/test/test_$ARGUMENTS` to review all changes
33
+
- **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:
47
+
```python
48
+
# Base class - no marker here
49
+
class TestFoo:
50
+
def test_something(self):
51
+
...
52
+
53
+
class TestPyFoo(TestFoo, PyTest): pass
54
+
55
+
class TestCFoo(TestFoo, CTest):
56
+
# TODO: RUSTPYTHON
57
+
@unittest.expectedFailure
58
+
def test_something(self):
59
+
return super().test_something()
60
+
```
61
+
- **New tests from CPython**: The upgrade may bring in entirely new tests that didn't exist before. These won't have any RUSTPYTHON markers in the diff - they just need to be tested and marked if they fail.
62
+
- Example markers:
63
+
```python
64
+
# TODO: RUSTPYTHON
65
+
@unittest.expectedFailure
66
+
def test_something(self):
67
+
...
68
+
69
+
# TODO: RUSTPYTHON
70
+
@unittest.skip("TODO: RUSTPYTHON; panics with 'index out of bounds'")
71
+
def test_crashes(self):
72
+
...
73
+
```
21
74
22
75
## Example Usage
23
76
```
@@ -26,7 +79,30 @@ Upgrade a Python standard library module from CPython to RustPython.
26
79
/upgrade-pylib asyncio
27
80
```
28
81
82
+
## Example: Restoring RUSTPYTHON changes
83
+
84
+
When git diff shows removed RUSTPYTHON-specific code like:
85
+
```diff
86
+
-# XXX RUSTPYTHON: we don't import _json as fresh since...
- After upgrading, you may need to run tests to verify: `cargo run --release -- -m test test_$ARGUMENTS`
99
+
-`scripts/lib_updater.py` handles basic patching:
100
+
- Transfers `@unittest.expectedFailure` and `@unittest.skip` decorators with `TODO: RUSTPYTHON` markers
101
+
- Adds `import unittest # XXX: RUSTPYTHON` if needed for the decorators
102
+
-**Limitation**: If a class was restructured (e.g., method overrides removed), lib_updater will warn and skip those markers
103
+
- The script does NOT preserve all RustPython-specific changes - you must review `git diff` and restore them
104
+
- Common RustPython markers to look for:
105
+
-`# XXX: RUSTPYTHON` or `# XXX RUSTPYTHON` - Inline comments for code modifications
106
+
-`# TODO: RUSTPYTHON` - Test skip/failure markers
107
+
- Any code with `RUSTPYTHON` in comments that was removed in the diff
108
+
-**Important**: Not all changes in the git diff need to be restored. Only restore changes that have explicit `RUSTPYTHON` comments. Other changes are upstream CPython updates.
0 commit comments