Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xuzihaode opened this issue Aug 27, 2024 · 2 comments
Open

Comments

@xuzihaode
Copy link

xuzihaode commented Aug 27, 2024

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)
Repository owner deleted a comment Aug 27, 2024
Repository owner deleted a comment Aug 27, 2024
Repository owner deleted a comment Aug 27, 2024
@wu-clan
Copy link
Owner

wu-clan commented Aug 27, 2024

非常棒的工作,你可以为此提交PR吗?我将很高兴进行 review,谢谢

@wu-clan
Copy link
Owner

wu-clan commented Aug 29, 2024

Hi, @xuzihaode

这一行为破坏了 ids 中文解析,请提供其他方案,一旦测试通过,将立即在下一个版本中提供,谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants