Skip to content

Commit d2eaa8f

Browse files
authored
Merge pull request #94 from OpenTestSolar/dev/support-encode-run-result-name
支持对执行用例名进行编码
2 parents 93e4d1a + 62fb212 commit d2eaa8f

5 files changed

Lines changed: 9 additions & 8 deletions

File tree

‎pytest/pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "testsolar-pytestx"
3-
version = "0.1.38"
3+
version = "0.1.39"
44
description = "Pytest tool for TestSolar"
55
authors = [
66
{name = "asiazhang2002", email = "asiazhang2002@gmail.com"},

‎pytest/src/testsolar_pytestx/converter.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,6 @@ def pytest_to_selector(item: Item, project_path: str) -> str:
8282
full_name = f"{rel_path}?{quote(name)}"
8383
elif hasattr(item, "nodeid") and item.nodeid:
8484
full_name = normalize_testcase_name(item.nodeid)
85-
if "?" in full_name:
86-
path = full_name.split("?", 1)[0]
87-
case_name = full_name.split("?", 1)[-1]
88-
full_name = "?".join([path, quote(case_name)])
8985
else:
9086
rel_path, _, name = item.location
9187
name = name.replace(".", "/")
@@ -140,4 +136,8 @@ def normalize_testcase_name(name: str, sub_case_key: Optional[str] = None) -> st
140136
name = decode_datadrive(name)
141137
if sub_case_key:
142138
name += CASE_DRIVE_SEPARATOR + sub_case_key
139+
if "?" in name:
140+
path = name.split("?", 1)[0]
141+
case_name = name.split("?", 1)[-1]
142+
return "?".join([path, quote(case_name)])
143143
return name

‎pytest/tests/test_executor.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ def test_run_testcase_with_emoji_data_drive(self):
295295

296296
start = read_test_result(pipe_io)
297297
self.assertEqual(
298-
start.Test.Name, "test_emoji_data_drive.py?test_emoji_data_drive_name/[\U0001f604]"
298+
start.Test.Name,
299+
"test_emoji_data_drive.py?test_emoji_data_drive_name/%5B%F0%9F%98%84%5D",
299300
)
300301
self.assertEqual(start.ResultType, ResultType.RUNNING)

‎pytest/testtool.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ schemaVersion: 1.0
22
name: pytest
33
nameZh: pytest自动化测试
44
lang: python
5-
version: '0.1.38'
5+
version: '0.1.39'
66
langType: INTERPRETED
77
description: |-
88
pytest是一个成熟的全功能Python测试工具,可以帮助您编写更好的程序。此测试工具允许您在TestSolar上运行pytest。

‎pytest/uv.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)