diff --git a/src/pytest_html/result.py b/src/pytest_html/result.py index a9313c17..d36c7672 100644 --- a/src/pytest_html/result.py +++ b/src/pytest_html/result.py @@ -18,7 +18,7 @@ class TestResult: def __init__(self, outcome, report, logfile, config): - self.test_id = report.nodeid.encode("utf-8").decode("unicode_escape") + self.test_id = report.nodeid if getattr(report, "when", "call") != "call": self.test_id = "::".join([report.nodeid, report.when]) self.time = getattr(report, "duration", 0.0) diff --git a/testing/test_pytest_html.py b/testing/test_pytest_html.py index 88477556..8c6460f9 100644 --- a/testing/test_pytest_html.py +++ b/testing/test_pytest_html.py @@ -1044,7 +1044,7 @@ def test_pass(utf8): ) result, html = run(testdir) assert result.ret == 0 - assert r"\u6d4b\u8bd5\u7528\u4f8b\u540d\u79f0" not in html + assert r"测试用例名称" not in html @pytest.mark.parametrize("is_collapsed", [True, False]) def test_collapsed(self, testdir, is_collapsed):