Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to update test files

Boris Verkhovskiy edited this pageApr 4, 2023 ·5 revisions

If you are looking for how to create a new test file, seeHow to contribute to RustPython using CPython's unit tests

Because we have many# TODO: RUSTPYTHON marks in the test code, updating is not trivial but still straightforward with a few tricks.

I am going to reproduce#3448 again to show the process.

Checkout CPython source code

We prefer to use version-tagged CPython source code than untagged one.

In the CPython repository,

$ git checkout v3.11.2

Copy CPython source code to RustPython

$ cp ../cpython/Lib/test/test_math.py Lib/test/test_math.py

Partial update

image

This is the current state. Because we replaced the whole file with a new CPython one, we have the updated parts of the file but we've also lost our original edits.

Don't worry. Just rungit add -p.

Typey to accept any updates from CPython

image

We have 31 parts for this file. Keep going until you hit the original RustPython-specific edits.

image

Here, we're finally on one of the original edits. Presss to split it.

image

Andn to reject our original edit to be lost.

image

Andy to accept CPython update again.

image

Keep going. Basically,n for any lines withTODO: RUSTPYTHON andy for everything else.

Commit and reset

Nowgit diff shows onlyTODO: RUSTPYTHON related changes

image

Commit it

$ git commit -m"Update test_math.py from CPython v3.10.0"

And reset to restore our original edits.

$ git reset --hard

Now the test file is updated, but we don't know if it passes yet - because there are newly added tests now.

Run the tests again

$ cargo run Lib/test/test_math.py

If there are failing tests, follow the instructions fromHow to contribute to RustPython using CPython's unit tests for the newly failing tests.

Done!

Please create a Pull Request with these changes. Thank you!

Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp