From b1efff976082b2fabe79c94b46547ff0fece7c92 Mon Sep 17 00:00:00 2001 From: danceratopz Date: Wed, 5 Aug 2026 14:58:59 +0200 Subject: [PATCH 1/2] fix(test-execute): register per-test hive test cases with the client Set `multi_test` on the session-scoped shared client and register it with every per-test hive test case, mirroring `consume enginex`. Hive then attaches the client and a per-test log segment to each individual test entry and marks the base test as the multi-test lifecycle owner, enabling per-test client logs in hiveview. This breaks `execute hive` against hive versions from before ethereum/hive#1402 (on master since 2026-03-17): registration fails loudly during every test's setup. This was deemed reasonable (enginex has the same requirement and no fallback) and preferable to carrying a defensive fallback path. --- .../pytest_commands/plugins/execute/rpc/hive.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/rpc/hive.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/rpc/hive.py index cc06ac10e3..105ae219da 100644 --- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/rpc/hive.py +++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/rpc/hive.py @@ -295,14 +295,16 @@ def test_case_description(request: pytest.FixtureRequest) -> str: @pytest.fixture(autouse=True) -def per_test_hive_test(hive_test: HiveTest) -> None: +def per_test_hive_test(client: Client, hive_test: HiveTest) -> None: """ Report each pytest test as an individual hive test case. - The client runs under the session-scoped base hive test; this - per-test entry only propagates the individual test result to hive. + The client runs under the session-scoped base hive test; register + it with each per-test entry so hive attaches the client and its + log segment to the individual test case and marks the base test + as the multi-test lifecycle owner. """ - del hive_test + hive_test.register_multi_test_client(client) @pytest.fixture(autouse=True, scope="session") @@ -431,6 +433,11 @@ def client( with open(users_file, "w") as f: json.dump(users, f) + # Set on every worker (the client object is shared across xdist + # workers via JSON serialization) so that per-test hive test cases + # can register with the client. + client.multi_test = True + yield client with FileLock(users_lock_file): From e960b764961c0b6e6f6454a7e86bcf68cc5b06ba Mon Sep 17 00:00:00 2001 From: danceratopz Date: Wed, 5 Aug 2026 14:59:33 +0200 Subject: [PATCH 2/2] fix(test-execute): end the base hive test as the multi-test context Since per-test hive test cases now report individual results (and hive marks the base test as the multi-test lifecycle owner, which hiveview and hive-ui exclude from test stats), ending the base test with the run's failure status double-reported every failure as an extra failing entry. End it `pass=True` as the multi-test context, matching enginex's `multi_test_hive_test`, unless the client failed to start. The previous `request.session.testsfailed` check was also unreliable under xdist: Only the last worker to finish ended the test, using its own per-worker failure count. --- .../pytest_commands/plugins/execute/rpc/hive.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/rpc/hive.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/rpc/hive.py index 105ae219da..9498482afd 100644 --- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/rpc/hive.py +++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/execute/rpc/hive.py @@ -309,7 +309,6 @@ def per_test_hive_test(client: Client, hive_test: HiveTest) -> None: @pytest.fixture(autouse=True, scope="session") def base_hive_test( - request: pytest.FixtureRequest, test_suite: HiveTestSuite, session_temp_folder: Path, ) -> Generator[HiveTest, None, None]: @@ -349,11 +348,17 @@ def base_hive_test( yield test - test_pass = True - test_details = "All tests have completed" - if request.session.testsfailed > 0: + # Individual results are reported by the per-test hive test cases, + # and hive marks this test as the multi-test lifecycle owner, so it + # always passes unless the client failed to start (the client + # fixture leaves its error file behind on startup failure). + client_error_file = session_temp_folder / "hive_client.err" + if client_error_file.exists(): test_pass = False - test_details = "One or more tests have failed" + test_details = "Failed to start the client." + else: + test_pass = True + test_details = "Multi-test client context completed." with FileLock(users_lock_file): with open(users_file, "r") as f: