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

Commit18a076e

Browse files
committed
how to contribute by cpython unittest
1 parentc898e91 commit18a076e

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
layout:post
3+
title:"How to contribute to RustPython by CPython unittest"
4+
date:2020-04-04 02:30:00 +0900
5+
categories:guideline
6+
---
7+
8+
At the very end of 2019, we finally reached one of the short-term goals: CPython unittest support. Due to this enhancement, finding CPython compatibility is easier than before.
9+
Probably this will be the major source of contribution spots for the new contributors this year. Here is a simple guideline.
10+
11+
##Fix known compatibility bugs
12+
Let's find an incompatibility issue and fix it.
13+
14+
1. See`Lib/test` directory of the project. There are many`test_` prefixed files like`test_unicode.py`.
15+
2. Try to open one of them. It might look just fine at a glance - but search for`TODO: RUSTPYTHON` in the files. There are tons of skipped, marked as an expected failure or commented out tests.
16+
3. Choose one or two interesting bugs. Remove the test blocker - skip, expectedFailure or comments.
17+
4. Try to fix them.
18+
19+
Here is a quick tip to run single unittest file.
20+
21+
```sh
22+
$ RUSTPYTHONLIB=Lib cargo run --release Lib/test/test_unicode.py
23+
```
24+
25+
##Add a new unittest file
26+
Because CPython unittest is not perfectly working in RustPython, we are doing this one by one with editings.
27+
1. Download CPython source code.
28+
2. Check out a specific version of CPython. For now, 3.8.2 is recommended. (We are testing against CPython 3.8 and 3.8.2 is the most recent version for now)
29+
3. Copy a file from CPython`Lib/test`
30+
4. Commit the file without editing. Specify copied CPython version to commit message.
31+
5. Try to edit it until it runs without a crash or failure.
32+
6. Commit the changes to make it run. This is the core contribution.
33+
34+
Because RustPython is not perfect, "try to edit it until it runs" doesn't mean to make 100% successful running. The common editing methods here:
35+
1. At least it must be able to start to run the test. Fix the test code or bug until it runs at least a single unit of the test. Typically, unimplemented stdlib or missing files of unittest can make issues. Sometimes RustPython bugs make issues too.
36+
2. If any test is not loadable by`SyntaxError`, that part is required to be commented out.
37+
3. If any test leads to a crash of RustPython, this code is not possible to run. Mark the test to skip.
38+
4. If any test is run but fails, this is an incompatibility issue. Mark the test as an expected failure.
39+
40+
##Development guide
41+
For the general source of the development, please visit the[RustPython development guide](https://github.com/RustPython/RustPython/blob/master/DEVELOPMENT.md)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp