一个pytest插件,用于按函数和模块获取持续时间。
项目描述
pytest-extra-durations
获取有关测试套件速度的更多信息。
它还与pytest-xdist兼容。
安装
您可以通过pip
安装"pytest-extra-durations"。
pip install pytest-extra-durations
用法
此插件提供三种类型的信息。
所有测试/设置/拆卸持续时间的总和
这可以提供比pytest显示的总时间更多的信息,因为它不受pytest-dist中工作进程数量的影响,也不受收集时间的影响。
示例
============== Sum of all tests durations ===============
1.95s
这将始终显示,除非您卸载此插件,否则无法关闭。
模块中所有测试持续时间的总和
这将告诉您执行给定文件中的所有测试所需的时间。API与Pytest CLI中的--durations
类似。
pytest --modules-durations=4 ./path/to/test/directory
给出
=============== slowest 4 modules durations =============
1.17s tensorflow_addons/activations/tests/sparsemax_test.py
0.28s tensorflow_addons/activations/tests/gelu_test.py
0.10s tensorflow_addons/activations/tests/softshrink_test.py
0.09s tensorflow_addons/activations/tests/rrelu_test.py
测试函数所有测试持续时间的总和
一个测试函数可以生成多个测试,这些测试也可以在多个工作进程中执行。这将汇总单个测试函数产生的所有测试、设置和拆卸的持续时间,并报告较慢的测试。
API与Pytest CLI中的--durations
类似。
pytest --functions-durations=4 ./path/to/test/directory
给出
============ slowest test functions =============
0.99s tensorflow_addons/activations/tests/sparsemax_test.py::test_gradient_against_estimate
0.17s tensorflow_addons/activations/tests/gelu_test.py::test_same_as_py_func
0.09s tensorflow_addons/activations/tests/softshrink_test.py::test_same_as_py_func
0.08s tensorflow_addons/activations/tests/gelu_test.py::test_gelu
0.08s tensorflow_addons/activations/tests/rrelu_test.py::test_theoretical_gradients
待办事项
- 与line_profiler集成
许可证
根据MIT
许可证条款分发,"pytest-extra-durations"是免费和开源软件
项目详情
下载文件
下载适用于您平台的文件。如果您不确定选择哪一个,请了解更多关于 安装包 的信息。
源代码分布
pytest-extra-durations-0.1.3.tar.gz (4.2 kB 查看哈希值)
构建分布
关闭
pytest-extra-durations-0.1.3.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | b67a681e3432285c0201451f328782ee65f8e5592c5739cd732d315545de82a4 |
|
MD5 | a36b306c3c7d715dcd1796c9e825cbaa |
|
BLAKE2b-256 | 9e9c9f42b36184b5cbb4ea8e4a8c6402fe9772afba8fa3d22bb488d8886cdcf0 |
关闭
pytest_extra_durations-0.1.3-py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 5ad27c7302cc124884e04bd8feafa5995e2997c0805b3ce4189f9ff1288e1091 |
|
MD5 | e5e43a9ea0f3b15d6534275c4a429653 |
|
BLAKE2b-256 | c48aba599f530bf58e2fc70d3722a548974beddfab49aec480770714f53f0545 |