pytest插件,提供固定工具
项目描述
pytest-fixture-tools: Pytest fixture tools插件
《pytest-fixture-tools》包是pytest插件,提供各种固定工具。
安装
pip install pytest-fixture-tools
用法
显示固定重复项
如果您已安装pytest-fixture-tools插件,则可以使用其命令之一。
--show-fixture-duplicates - 将收集所有夹具并打印出每个夹具的重复项列表。
使用 --show-fixture-duplicates,您可以通过使用 --fixture name_of_fixture 选项来获取特定夹具的重复项列表。
py.test tests/ --show-fixture-duplicates --fixture order
输出可能如下所示
========================================== test session starts ==========================================
platform linux2 -- Python 2.7.3 -- pytest-2.5.1 -- /home/batman/.virtualenvs/arkham-city/bin/python
Tests are shuffled using seed number 355495648184.
cachedir: /home/batman/.virtualenvs/arkham-city/.cache
plugins: fixture-tools, random, bdd-splinter, pep8, cov, contextfixture, bdd, xdist, instafail, cache
collected 2347 items / 1 skipped
------------------------------------------------- order -------------------------------------------------
tests/fixtures/order.py:30
tests/unit/api/conftest.py:261
fixture-graph
您可以通过这种方式生成使用夹具图
# on windows gitbash as example
export PATH=$PATH:/c/Program\ Files\ \(x86\)/Graphviz2.38/bin/
pytest --fixture-graph -s
# or you can select the output direcotry like that:
pytest --fixture-graph --fixture-graph-output-dir=./test_output
# you can also change the output type of the graphs (any of graphvis supported outputs types):
pytest --fixture-graph --fixture-graph-type=jpg
输出将如下所示
============================= test session starts =============================
platform win32 -- Python 2.7.10, pytest-3.3.1, py-1.5.2, pluggy-0.6.0
rootdir: C:\Users\ifruchte\Projects\pytest-fixture-tools, inifile: tox.ini
plugins: pep8-1.0.6, cov-2.5.1, fixture-tools-1.0.0
collected 7 items
pytest_fixture_tools\__init__.py . [ 14%]
pytest_fixture_tools\plugin.py . [ 28%]
tests\__init__.py . [ 42%]
tests\conftest.py . [ 57%]
tests\test_fixture_duplicates.py .
-------------------------------- fixture-graph --------------------------------
created artifacts/fixture-graph-tests-test_fixture_duplicates.py__test_there_are_fixture_duplicates.png.
============================= test session starts =============================
platform win32 -- Python 2.7.10, pytest-3.3.1, py-1.5.2, pluggy-0.6.0
rootdir: c:\users\ifruchte\appdata\local\temp\pytest-of-ifruchte\pytest-445\test_there_are_not_fixture_duplicates0, inifile:
plugins: pep8-1.0.6, cov-2.5.1, fixture-tools-1.0.0
collected 2 items
======================== no tests ran in 0.06 seconds =========================
.s [100%]
===================== 6 passed, 1 skipped in 0.29 seconds =====================
最终输出,有助于进行依赖于大量夹具的测试
联系
如果您有任何问题、错误报告、建议等,请在此 GitHub 项目页面 上创建一个问题。
许可证
本软件根据 MIT 许可证 授权。
见 许可证
© 2013 Paylogic 国际。
变更日志
1.2.0
修复由 @youtux 在 https://github.com/pytest-dev/pytest-fixture-tools/pull/5 中解决的 –fixture-graph-output-dir 和 –fixture-graph-output-type
由 @ogajduse 解决的 Python 和 pytest 兼容性修复,详情请见 https://github.com/pytest-dev/pytest-fixture-tools/pull/7
停止支持已到期的 Python 版本
1.1.0
添加了 fixture-graph 选项。
1.0.0
首次公开发布
项目详情
下载文件
下载适合您平台的应用程序。如果您不确定选择哪个,请了解更多关于 安装软件包 的信息。
源代码分发
pytest_fixture_tools-1.2.0.tar.gz (6.7 kB 查看哈希值)
构建版本
关闭
pytest_fixture_tools-1.2.0.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | b5871711e85cabec4e416c18d59c59c4ffdd39ee0b00a0d67ab5cb97e81cf79c |
|
MD5 | 026895bedb8c664e7306018a3faad2dd |
|
BLAKE2b-256 | e70b5b72374d1c53bd820326291650c527c1118a00e9768599395b2209a70ac3 |
关闭
pytest_fixture_tools-1.2.0-py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | bf36e8ab000fc0a972fe6ba9fda5a54c2d74c9693b7594757d97caa29eb067c5 |
|
MD5 | fcd4803549b915559198a0681917a6ef |
|
BLAKE2b-256 | 7dc269434531f50be723ade2a858a2b40186bcdd799bead14fea3cfe1cfb989d |