摘要:
--durations用于计算每个用例执行的执行时间,并进行排序 > pytest -h --durations=N show N slowest setup/test durations (N=0 for all). --durations-min=N Minimal duration in se 阅读全文
posted @ 2022-01-21 14:52
小哈别闹
阅读(228)
评论(0)
推荐(1)
摘要:
当用命令pytest执行用例时,控制台会输出很多信息,不方便追溯问题信息,可以通过--tb命令行参数控制输入信息内容 pytest -h 查看--tb参数的使用方法 > pytest -h --tb=style traceback print mode (auto/long/short/line/n 阅读全文
posted @ 2022-01-21 14:44
小哈别闹
阅读(222)
评论(0)
推荐(0)
摘要:
获取测试用例的运行结果: #conftest.py import pytest @pytest.hookimpl(hookwrapper=True, tryfirst=True) def pytest_runtest_makereport(item, call): print(' ') # 获取钩子 阅读全文
posted @ 2022-01-21 14:15
小哈别闹
阅读(221)
评论(0)
推荐(0)
摘要:
在Pytest中,conftest.py中方法命名越复杂时,就显得难以理解,这时可以使用别名来使代码更加容易解读 只需使用fixture中的name参数即可,案例如下: #conftest.py import pytest @pytest.fixture(scope="session",name=" 阅读全文
posted @ 2022-01-21 13:47
小哈别闹
阅读(48)
评论(0)
推荐(0)

浙公网安备 33010602011771号