08、分析测试执行时间及获取pytest帮助

官方用例

python 复制代码
# content of test_slow_func.py
import pytest
from time import sleep

@pytest.mark.parametrize('delay',(1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,1.0,0.1,0.2,0,3))
def test_slow_func(delay):
    print("test_slow_func {}".format(delay))
    sleep(delay)
    assert 1

解读与实操

  • 查询pytest版本号
  • 查询所有pytest的fixture
  • 查询所有pytest的帮助

应用场景

  • 遇到新场景,想查看下pytest中是否有相应实现。
  • 看到其他人使用了某个特性,要了解相关用法

以上两种场景,都可以通过pytest -h 帮助,要查询或了解。

相关推荐
bjwuzh3 天前
使用pytest实现参数化后,控制台输出的日志是乱码
pytest
2025年一定要上岸4 天前
pytest框架 - 第二集 allure报告
pytest
头疼的程序员5 天前
allure生成测试报告(搭配Pytest、allure-pytest)
测试工具·pytest
文人sec6 天前
接口自动化测试设计思路--设计实战
python·https·单元测试·自动化·pytest
测试开发Kevin7 天前
从投入产出、效率、上手难易度等角度综合对比 pytest 和 unittest 框架
python·pytest
测试开发Kevin10 天前
以pytest_addoption 为例,讲解pytest框架中钩子函数的应用
python·pytest
川石教育15 天前
Pytest中的fixture装饰器详解
python自动化测试·pytest·pytest自动化测试框架·pytest测试框架·pytest单元测试框架
春风又。16 天前
接口自动化——参数化
python·测试工具·自动化·pytest
XTY0018 天前
mac电脑pytest生成测试报告
pytest
程序员的世界你不懂18 天前
pytest-前后置及fixture运用
pytest