相关疑难解决方法(0)

我可以在哪个py.test标注中找到'item'和'report'数据?

pytest_runtest_makereport()获取两个参数,item和call.从item,我可以找到我为此测试创建的funcarg,并且从call中,我可以找到异常信息(如果有的话):

def pytest_runtest_makereport (item, call):
    my_funcarg = item.funcargs['name']
    my_funcarg.excinfo = call.excinfo
Run Code Online (Sandbox Code Playgroud)

不幸的是,填充了两个失败和跳过的excinfo.为了区分,我需要查看pytest_report_teststatus()的report参数:

def pytest_report_teststatus (report):
    if report.when == 'call':
        if report.failed:
            failed = True
        elif report.skipped:
            skipped = True
        else:
            passed = True
Run Code Online (Sandbox Code Playgroud)

这是很好的信息,但我无法将其与我为测试创建的funcarg相关联.我查看了report参数(一个TestReport报告),我找不到任何方法可以回到传递给pytest_runtest_makereport()的项目,或者我创建的funcarg.

我在哪里可以访问这两个?

python pytest

6
推荐指数
1
解决办法
3123
查看次数

标签 统计

pytest ×1

python ×1