@@ -41,6 +41,49 @@ def pytest_generate_tests(metafunc):
41
41
)
42
42
43
43
44
+ @pytest .hookimpl (trylast = True )
45
+ def pytest_collection_modifyitems (session , config , items ):
46
+ """Modify test IDs to show both client and sync client clearly."""
47
+ for item in items :
48
+ # Check if this test has both client_type and sync_client_type
49
+ if (
50
+ hasattr (item , "callspec" )
51
+ and "client_type" in item .callspec .params
52
+ and "sync_client_type" in item .callspec .params
53
+ ):
54
+ # Get the client names and remove fork suffix if present
55
+ client_name = item .callspec .params ["client_type" ].name .replace ("-" , "_" )
56
+ sync_client_name = item .callspec .params ["sync_client_type" ].name .replace ("-" , "_" )
57
+
58
+ # Format: ``-{client}_sync_{sync_client}``
59
+ new_suffix = f"-{ client_name } ::sync_{ sync_client_name } "
60
+
61
+ # client_param-tests/path/to/test.py::test_name[test_params]-sync_client_param
62
+ # 1. Remove the client prefix from the beginning
63
+ # 2. Replace the -client_param part at the end with our new format
64
+ nodeid = item .nodeid
65
+ prefix_index = item .nodeid .find ("-tests/" )
66
+ if prefix_index != - 1 :
67
+ nodeid = item .nodeid [prefix_index + 1 :]
68
+
69
+ # Find the last hyphen followed by client name pattern and replace
70
+ if "-" in nodeid :
71
+ # Split by the last hyphen to separate the client suffix
72
+ parts = nodeid .rsplit ("]-" , 1 )
73
+ assert len (parts ) == 2 , (
74
+ # expect "..._end_of_test]-client_name" suffix...
75
+ f"Unexpected format to parse client name: { nodeid } "
76
+ )
77
+
78
+ base = parts [0 ]
79
+ if base .endswith ("sync_test" ):
80
+ # Insert suffix before the closing bracket
81
+ base = base + new_suffix + "]"
82
+ item ._nodeid = base
83
+ else :
84
+ item ._nodeid = base + new_suffix
85
+
86
+
44
87
@pytest .fixture (scope = "function" )
45
88
def engine_rpc (client : Client , client_exception_mapper : ExceptionMapper | None ) -> EngineRPC :
46
89
"""Initialize engine RPC client for the execution client under test."""
0 commit comments