一个pytest插件,用于根据敷衍和每个模块获取持续时间。

pytest-extra-durations的Python项目详细描述


pytest额外持续时间

获取有关测试套件速度的更多信息。在

它也适用于pytest xdist。在

安装

您可以通过pip安装“pytest extra durations”:

pip install pytest-extra-durations

用法

这个插件提供了三种类型的信息。在

所有测试/设置/拆卸持续时间的总和

这可以提供比pytest显示的总时间更多的信息,因为它 不受pytest dist中的工人数量或收集时间的影响。在

示例:

^{pr2}$

它将一直显示并且不能关闭,除非您 卸载此插件。在

模块所有测试持续时间的总和

这将告诉您在给定文件中执行所有测试所花费的时间。 该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”是免费的开源软件

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Android:如何写入特定行,Java   Java中从欧元货币字符串中删除空格的数字   Java非均匀多维数组   解密AES时出现java空指针异常   java ConcurrentModificationException尝试移除列表上的所有内容时(非迭代)   Java数学库计算日志   java ISO8601,使用Jackson以毫秒表示json   避免副作用的java最佳实践   java获取JMeterException:调用bsh方法时出错:未定义参数:saa。使用beanshell取样器时   使用javascript将会话从一个jsp页面传输到另一个jsp页面   java在列表中组合相邻元素   java多行JTextPane   java Hibernate映射文件连接两个表而不定义关系?   如何使用Ajax、Java和Spring框架将文件从网页上传到Google云存储   多线程多线程Java中producerconsumer代码的多线程没有提供正确的输出?