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 帮助,要查询或了解。

相关推荐
思则变1 天前
[Pytest][Part 1]Pytest 自动化测试框架
pytest
思则变3 天前
[Pytest] [Part 2]增加 log功能
开发语言·python·pytest
思则变3 天前
[Pytest][Part 3]检测python package状态
pytest
cooldream200917 天前
pytest 框架详解与实战指南
pytest·测试
慕城南风17 天前
【pytest进阶】Pytest之conftest详解
pytest
编程小白gogogo18 天前
AI自动化测试速成(Pytest框架)
pytest
慕城南风18 天前
【pytest进阶】pytest详解及进阶使用
linux·服务器·pytest
Tom Boom25 天前
Pytest断言全解析:掌握测试验证的核心艺术
自动化测试·python·测试开发·pytest
不要一直敲门1 个月前
初学 pytest 记录
pytest