贡献¶
urllib3是一个社区维护的项目,我们很高兴接受贡献。
如果要添加新功能或修复错误:
Check for open issues 或者打开一个新的问题,围绕一个功能想法或一个bug展开讨论。有一个 贡献者友好 标记对于那些还不太熟悉代码库的人来说应该是理想的问题。
叉 urllib3 repository on Github 开始做你的改变。
编写一个测试,显示错误已修复或功能按预期工作。
使用命令将更改格式化为黑色 $ nox -rs format 并使用命令lint您的更改 nox -rs lint .
发送一个请求并对维护者进行bug,直到它被合并和发布。:)确保将自己添加到
CONTRIBUTORS.txt
.
运行测试¶
在运行测试套件时,我们使用一些外部依赖项、多个解释器和代码覆盖率分析。我们的 noxfile.py
帮你处理很多事情:
$ nox --reuse-existing-virtualenvs --sessions test-2.7 test-3.7
[ Nox will create virtualenv if needed, install the specified dependencies, and run the commands in order.]
nox > Running session test-2.7
.......
.......
nox > Session test-2.7 was successful.
.......
.......
nox > Running session test-3.7
.......
.......
nox > Session test-3.7 was successful.
还有一个nox命令用于运行我们的所有测试和多个python版本:
$ nox --reuse-existing-virtualenvs --sessions test
注意,小于100%的代码覆盖率被视为失败的运行。某些特定于平台的测试将被跳过,除非在该平台中运行。为了确保代码在所有URLLB3支持的平台中工作,您可以运行我们的 tox
一套::
$ nox --reuse-existing-virtualenvs --sessions test
[ Nox will create virtualenv if needed, install the specified dependencies, and run the commands in order.]
.......
.......
nox > Session test-2.7 was successful.
nox > Session test-3.4 was successful.
nox > Session test-3.5 was successful.
nox > Session test-3.6 was successful.
nox > Session test-3.7 was successful.
nox > Session test-3.8 was successful.
nox > Session test-pypy was successful.
我们的测试套件 runs continuously on Travis CI 每一个请求。
要运行特定的测试或在不重新创建env的情况下快速重新运行,请执行以下操作:
$ nox --reuse-existing-virtualenvs --sessions test-3.8 -- pyTestArgument1 pyTestArgument2 pyTestArgumentN
[ Nox will create virtualenv, install the specified dependencies, and run the commands in order.]
nox > Running session test-3.8
nox > Re-using existing virtual environment at .nox/test-3-8.
.......
.......
nox > Session test-3.8 was successful.
后 --
指示器,则任何参数都将传递给pytest。要指定精确的测试用例,以下语法也可以使用: test/dir/module_name.py::TestClassName::test_method_name
(例如: test/with_dummyserver/test_https.py::TestHTTPS::test_simple
). 以下参数是传递给pytest的另一个有效示例: -k test_methode_name
. 这些在开发新的测试用例时非常有用,而且没有必要每次迭代都重新运行整个测试套件。还可以为本地测试进一步参数化pytest。
对于所有有效参数,请检查 the pytest documentation .
发行版¶
通过创建一个分支,可以由任何贡献者创建发布候选。 release-x.x
在哪里? x.x
是建议发布的版本。
更新
CHANGES.rst
和urllib3/__init__.py
使用正确的版本号并将更改提交到release-x.x
.打开拉取请求以合并
release-x.x
分支到master
分支机构。对travis上的候选发布版本运行集成测试。从这里开始,下面的所有步骤都将由维护人员处理,因此除非您收到评审意见,否则请在这里完成。
一旦pull请求被挤压合并到master中,合并维护程序将用版本号标记合并提交:
git tag -a 1.24.1 [commit sha]
git push origin master --tags
在提交被标记之后,travis将构建标记的提交,并将sdist和wheel上传到pypi,并在github上为该标记创建一个草稿版本。合并维护程序将确保pypi sdist和wheel被正确上传。
合并维护者将在github上将草稿版本标记为已批准的版本。