From 1b2deb154e7297b95ab60d862638daf95bbff23f Mon Sep 17 00:00:00 2001 From: Adil Hafeez Date: Thu, 25 Dec 2025 14:14:10 -0800 Subject: [PATCH] fix tests --- cli/test/test_config_generator.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/cli/test/test_config_generator.py b/cli/test/test_config_generator.py index dd2cf809..420987b5 100644 --- a/cli/test/test_config_generator.py +++ b/cli/test/test_config_generator.py @@ -59,13 +59,13 @@ tracing: random_sampling: 100 """ arch_config_schema = "" - with open("../../config/arch_config_schema.yaml", "r") as file: + with open("../config/arch_config_schema.yaml", "r") as file: arch_config_schema = file.read() m_open = mock.mock_open() # Provide enough file handles for all open() calls in validate_and_render_schema m_open.side_effect = [ - mock.mock_open(read_data="").return_value, + # Removed empty read - was causing validation failures mock.mock_open(read_data=arch_config).return_value, # ARCH_CONFIG_FILE mock.mock_open( read_data=arch_config_schema @@ -78,7 +78,7 @@ tracing: mock.mock_open().return_value, # ARCH_CONFIG_FILE_RENDERED (write) ] with mock.patch("builtins.open", m_open): - with mock.patch("config_generator.Environment"): + with mock.patch("planoai.config_generator.Environment"): validate_and_render_schema() @@ -108,7 +108,7 @@ agents: listeners: - name: tmobile type: agent - router: arch_agent_v2 + router: plano_orchestrator_v1 agents: - name: simple_tmobile_rag_agent description: t-mobile virtual assistant for device contracts. @@ -132,13 +132,13 @@ listeners: model: openai/gpt-4o """ arch_config_schema = "" - with open("../../config/arch_config_schema.yaml", "r") as file: + with open("../config/arch_config_schema.yaml", "r") as file: arch_config_schema = file.read() m_open = mock.mock_open() # Provide enough file handles for all open() calls in validate_and_render_schema m_open.side_effect = [ - mock.mock_open(read_data="").return_value, + # Removed empty read - was causing validation failures mock.mock_open(read_data=arch_config).return_value, # ARCH_CONFIG_FILE mock.mock_open( read_data=arch_config_schema @@ -319,26 +319,29 @@ def test_validate_and_render_schema_tests(monkeypatch, arch_config_test_case): expected_error = arch_config_test_case.get("expected_error") arch_config_schema = "" - with open("../../config/arch_config_schema.yaml", "r") as file: + with open("../config/arch_config_schema.yaml", "r") as file: arch_config_schema = file.read() m_open = mock.mock_open() # Provide enough file handles for all open() calls in validate_and_render_schema m_open.side_effect = [ - mock.mock_open(read_data="").return_value, - mock.mock_open(read_data=arch_config).return_value, # ARCH_CONFIG_FILE + mock.mock_open( + read_data=arch_config + ).return_value, # validate_prompt_config: ARCH_CONFIG_FILE mock.mock_open( read_data=arch_config_schema - ).return_value, # ARCH_CONFIG_SCHEMA_FILE - mock.mock_open(read_data=arch_config).return_value, # ARCH_CONFIG_FILE + ).return_value, # validate_prompt_config: ARCH_CONFIG_SCHEMA_FILE + mock.mock_open( + read_data=arch_config + ).return_value, # validate_and_render_schema: ARCH_CONFIG_FILE mock.mock_open( read_data=arch_config_schema - ).return_value, # ARCH_CONFIG_SCHEMA_FILE + ).return_value, # validate_and_render_schema: ARCH_CONFIG_SCHEMA_FILE mock.mock_open().return_value, # ENVOY_CONFIG_FILE_RENDERED (write) mock.mock_open().return_value, # ARCH_CONFIG_FILE_RENDERED (write) ] with mock.patch("builtins.open", m_open): - with mock.patch("config_generator.Environment"): + with mock.patch("planoai.config_generator.Environment"): if expected_error: # Test expects an error with pytest.raises(Exception) as excinfo: