向开源社区贡献
When contributing code, you’ll want to follow this checklist:
- Fork the repository on GitHub.
- Run the tests to confirm they all pass on your system. If they don’t, you’ll need to investigate why they fail. If you’re unable to diagnose this yourself, raise it as a bug report by following the guidelines in this document: Bug Reports.
- Write tests that demonstrate your bug or feature. Ensure that they fail.
- Make your change.
- Run the entire test suite again, confirming that all tests pass including the ones you just added.
- Send a GitHub Pull Request to the main repository’s master branch. GitHub Pull Requests are the expected method of code collaboration on this project.
在其中的第 2 步可以创建虚拟环境,防止环境冲突
$ git clone https://project.git
$ cd project
# virtualenv
$ virtualenv -p python3 venv
$ source venv/bin/activate
[安装程序](venv) $ pip install --editable .
[安装依赖](venv) $ pip install -r requirements.txt
(venv) $ py.test tests # Runing test
(venv) $ deactivate # 退出虚拟环境
# tox
$ tox -e py36
# 执行特定测试
$ tox -e flake8
# 执行特定文件测试
$ tox -e py36 tests/test_file.py