httpfpt icon indicating copy to clipboard operation
httpfpt copied to clipboard

testcase下测试文件及类名为中文时,报告中文显示乱码

Open xuzihaode opened this issue 6 months ago • 2 comments

conftest.py把原有的函数pytest_collection_modifyitems修改成以下内容就OK了

@pytest.hookimpl(tryfirst=True)
def pytest_collection_modifyitems(items):
    """
    解决数据驱动ids参数为中文时,控制台输出乱码问题
    解决allure报告中文乱码
    :param items:
    :return:
    """
    for item in items:
        item.name = unicodedata.normalize('NFKC', item.name)
        item._nodeid = unicodedata.normalize('NFKC', item.nodeid)

xuzihaode avatar Aug 27 '24 08:08 xuzihaode