The pytest
framework makes it easy to write small tests, yet
scales to support complex functional testing for applications and libraries.
(pytest框架使编写小型测试变得容易,但是可以扩展以支持应用程序和库的复杂功能测试。)
An example of a simple test:
# content of test_sample.py
def inc(x):
return x + 1
def test_answer():
assert inc(3) == 5
To execute it:
$ pytest ============================= test session starts ============================= collected 1 items test_sample.py F ================================== FAILURES =================================== _________________________________ test_answer _________________________________ def test_answer(): > assert inc(3) == 5 E assert 4 == 5 E + where 4 = inc(3) test_sample.py:5: AssertionError ========================== 1 failed in 0.04 seconds ===========================
Due to pytest
's detailed assertion introspection, only plain assert
statements are used. See getting-started for more examples.
(由于“pytest”的详细断言内省,只使用了简单的“assert”语句。请参见“入门<https://docs.pytest.org/en/latest/getting started.html”我们的第一次测试运行>``。)
self.assert*
names);(关于失败的“assert语句”的详细信息(不需要记住“self.assert*”名称);)
(可以运行“unittest<https://docs.pytest.org/en/latest/unittest.html>`(或trial),`nose<https://docs.pytest.org/en/latest/nose.html>``开箱即用的测试套件;)
(丰富的插件架构,拥有超过315个“外部插件”和欣欣向荣的社区;)
For full documentation, including installation, tutorials and PDF documents, please see https://docs.pytest.org/en/latest/. (有关完整的文档,包括安装、教程和PDF文档,请参见https://docs.pytest.org/en/latest/。)
Please use the GitHub issue tracker to submit bugs or request features. (请使用“GitHub issue tracker<https://GitHub.com/pytest dev/pytest/issues>``提交错误或请求功能。)
Consult the Changelog page for fixes and enhancements of each version. (请参阅“Changelog<https://docs.pytest.org/en/latest/Changelog.html>``页面,了解每个版本的修复和增强。)
Open Collective is an online funding platform for open and transparent communities. It provide tools to raise money and share your finances in full transparency. (`“开放集体”是一个开放透明社区的在线融资平台。它提供了筹集资金和完全透明地分享财务的工具。)
It is the platform of choice for individuals and companies that want to make one-time or monthly donations directly to the project. (它是个人和公司选择的平台,希望一次性或每月直接向项目捐款。)
See more datails in the pytest collective.
Available as part of the Tidelift Subscription. (作为Tidelift订阅的一部分提供。)
The maintainers of pytest and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. (pytest和数千个其他软件包的维护人员正在与Tidelift合作,以提供商业支持和维护用于构建应用程序的开放源代码依赖项。 节省时间、降低风险和改善代码运行状况,同时向维护者支付使用的确切依赖项的费用。)
pytest has never been associated with a security vunerability, but in any case, to report a security vulnerability please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure. (pytest从未与安全漏洞关联,但无论如何,要报告安全漏洞请使用“Tidelift security contact<https://Tidelift.com/security>`”。 Tidelift将协调修复和披露。)
Copyright Holger Krekel and others, 2004-2019. (版权所有Holger Krekel等人,2004-2019年。)
Distributed under the terms of the MIT license, pytest is free and open source software. (pytest是根据“MIT”许可证的条款发布的,是免费的开源软件。)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。