跳转到主要内容

xdist运行后列出工作统计信息的pytest插件。

项目描述

pytest-xdist-worker-stats

xdist运行后列出工作统计信息的pytest插件。

安装

$ pip install pytest-xdist-worker-stats

用法

只需安装并启用xdist,并在多个工作器中运行测试即可。

默认模式

pytest {all_your_options}
============================= test session starts ==============================
platform linux -- Python 3.10.7, pytest-8.1.1, pluggy-1.4.0
plugins: xdist-worker-stats-0.2.0, xdist-3.5.0
created: 2/2 workers
2 workers [4 items]

....                                                                     [100%]
============================== Worker statistics ===============================
worker gw0  :    2 tests       0.00s runtime
worker gw1  :    2 tests       0.00s runtime

Tests   : min        2, max        2, average 2.0
Runtime : min    0.00s, max    0.00s, average 0.00s
============================== 4 passed in 1.82s ===============================

摘要模式

pytest {all_your_options} --no-xdist-runtimes
============================= test session starts ==============================
platform linux -- Python 3.10.7, pytest-8.1.1, pluggy-1.4.0
plugins: xdist-worker-stats-0.2.0, xdist-3.5.0
created: 2/2 workers
2 workers [4 items]

....                                                                     [100%]
============================== Worker statistics ===============================
Tests   : min        2, max        2, average 2.0
Runtime : min    0.00s, max    0.00s, average 0.00s
============================== 4 passed in 1.82s ===============================

分解模式

pytest {all_your_options} --xdist-breakdown
============================= test session starts ==============================
platform linux -- Python 3.10.7, pytest-8.1.1, pluggy-1.4.0
plugins: xdist-worker-stats-0.2.0, xdist-3.5.0
created: 2/2 workers
2 workers [4 items]

....                                                                     [100%]
============================== Worker statistics ===============================
worker gw0  :    2 tests       0.00s runtime
    test_plugin.py::test_bar[1]
    test_plugin.py::test_foo
worker gw1  :    2 tests       0.00s runtime
    test_plugin.py::test_bar[2]
    test_plugin.py::test_bar[3]

Tests   : min        2, max        2, average 2.0
Runtime : min    0.00s, max    0.00s, average 0.00s
============================== 4 passed in 1.82s ===============================

开发

开发需要Poetry(依赖项)和pre-commit(编码标准)。

$ poetry install
$ pre-commit install

感谢

非常感谢Denys Korytkin提供的文章如何从pytest-xdist节点获取数据

变更日志

0.1.4 (2023年8月8日)

  • 总结统计数据

0.1.3 (2023年8月8日)

  • 添加CI

0.1.2 (2023年6月19日)

  • 修复几个问题

0.1.1 (2023年6月15日)

  • 首次发布

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分布

pytest_xdist_worker_stats-0.2.0.tar.gz (4.7 kB 查看哈希值)

上传于

构建分布

pytest_xdist_worker_stats-0.2.0-py3-none-any.whl (6.3 kB 查看哈希值)

上传于 Python 3

支持