From 9dae67737ee284113afeaec8e565d4da890b3f40 Mon Sep 17 00:00:00 2001 From: "Brent E. Edwards" Date: Tue, 31 Mar 2026 01:28:15 +0000 Subject: [PATCH] fix(cli): use container DI override for correction service mock in integration test The plan_correct_isolated_resolve robot helper patched CorrectionService at the module level, but correct_decision now resolves the service via container.correction_service(). The module-level patch had no effect on the container's already-imported reference, causing the mock to never intercept the call and the test to fail with exit code 1. Replace unittest.mock.patch with container.correction_service.override() which is the idiomatic dependency-injector mechanism and correctly intercepts the singleton provider. ISSUES CLOSED: #1025 --- robot/helper_plan_correct_isolated_resolve.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/robot/helper_plan_correct_isolated_resolve.py b/robot/helper_plan_correct_isolated_resolve.py index 7a770cb77..13b15f71f 100644 --- a/robot/helper_plan_correct_isolated_resolve.py +++ b/robot/helper_plan_correct_isolated_resolve.py @@ -13,7 +13,7 @@ import os import tempfile from pathlib import Path from types import SimpleNamespace -from unittest.mock import MagicMock, patch +from unittest.mock import MagicMock from typer.testing import CliRunner from ulid import ULID @@ -90,10 +90,8 @@ def run_regression() -> int: ) runner = CliRunner() - with patch( - "cleveragents.application.services.correction_service.CorrectionService", - return_value=fake_svc, - ): + container = get_container() + with container.correction_service.override(fake_svc): result = runner.invoke( plan_app, [