mirror of
https://github.com/katanemo/plano.git
synced 2026-07-02 15:51:02 +02:00
fix tests
This commit is contained in:
parent
f7d9453b9c
commit
1b2deb154e
1 changed files with 16 additions and 13 deletions
|
|
@ -59,13 +59,13 @@ tracing:
|
||||||
random_sampling: 100
|
random_sampling: 100
|
||||||
"""
|
"""
|
||||||
arch_config_schema = ""
|
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()
|
arch_config_schema = file.read()
|
||||||
|
|
||||||
m_open = mock.mock_open()
|
m_open = mock.mock_open()
|
||||||
# Provide enough file handles for all open() calls in validate_and_render_schema
|
# Provide enough file handles for all open() calls in validate_and_render_schema
|
||||||
m_open.side_effect = [
|
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).return_value, # ARCH_CONFIG_FILE
|
||||||
mock.mock_open(
|
mock.mock_open(
|
||||||
read_data=arch_config_schema
|
read_data=arch_config_schema
|
||||||
|
|
@ -78,7 +78,7 @@ tracing:
|
||||||
mock.mock_open().return_value, # ARCH_CONFIG_FILE_RENDERED (write)
|
mock.mock_open().return_value, # ARCH_CONFIG_FILE_RENDERED (write)
|
||||||
]
|
]
|
||||||
with mock.patch("builtins.open", m_open):
|
with mock.patch("builtins.open", m_open):
|
||||||
with mock.patch("config_generator.Environment"):
|
with mock.patch("planoai.config_generator.Environment"):
|
||||||
validate_and_render_schema()
|
validate_and_render_schema()
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -108,7 +108,7 @@ agents:
|
||||||
listeners:
|
listeners:
|
||||||
- name: tmobile
|
- name: tmobile
|
||||||
type: agent
|
type: agent
|
||||||
router: arch_agent_v2
|
router: plano_orchestrator_v1
|
||||||
agents:
|
agents:
|
||||||
- name: simple_tmobile_rag_agent
|
- name: simple_tmobile_rag_agent
|
||||||
description: t-mobile virtual assistant for device contracts.
|
description: t-mobile virtual assistant for device contracts.
|
||||||
|
|
@ -132,13 +132,13 @@ listeners:
|
||||||
model: openai/gpt-4o
|
model: openai/gpt-4o
|
||||||
"""
|
"""
|
||||||
arch_config_schema = ""
|
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()
|
arch_config_schema = file.read()
|
||||||
|
|
||||||
m_open = mock.mock_open()
|
m_open = mock.mock_open()
|
||||||
# Provide enough file handles for all open() calls in validate_and_render_schema
|
# Provide enough file handles for all open() calls in validate_and_render_schema
|
||||||
m_open.side_effect = [
|
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).return_value, # ARCH_CONFIG_FILE
|
||||||
mock.mock_open(
|
mock.mock_open(
|
||||||
read_data=arch_config_schema
|
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")
|
expected_error = arch_config_test_case.get("expected_error")
|
||||||
|
|
||||||
arch_config_schema = ""
|
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()
|
arch_config_schema = file.read()
|
||||||
|
|
||||||
m_open = mock.mock_open()
|
m_open = mock.mock_open()
|
||||||
# Provide enough file handles for all open() calls in validate_and_render_schema
|
# Provide enough file handles for all open() calls in validate_and_render_schema
|
||||||
m_open.side_effect = [
|
m_open.side_effect = [
|
||||||
mock.mock_open(read_data="").return_value,
|
mock.mock_open(
|
||||||
mock.mock_open(read_data=arch_config).return_value, # ARCH_CONFIG_FILE
|
read_data=arch_config
|
||||||
|
).return_value, # validate_prompt_config: ARCH_CONFIG_FILE
|
||||||
mock.mock_open(
|
mock.mock_open(
|
||||||
read_data=arch_config_schema
|
read_data=arch_config_schema
|
||||||
).return_value, # ARCH_CONFIG_SCHEMA_FILE
|
).return_value, # validate_prompt_config: ARCH_CONFIG_SCHEMA_FILE
|
||||||
mock.mock_open(read_data=arch_config).return_value, # ARCH_CONFIG_FILE
|
mock.mock_open(
|
||||||
|
read_data=arch_config
|
||||||
|
).return_value, # validate_and_render_schema: ARCH_CONFIG_FILE
|
||||||
mock.mock_open(
|
mock.mock_open(
|
||||||
read_data=arch_config_schema
|
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, # ENVOY_CONFIG_FILE_RENDERED (write)
|
||||||
mock.mock_open().return_value, # ARCH_CONFIG_FILE_RENDERED (write)
|
mock.mock_open().return_value, # ARCH_CONFIG_FILE_RENDERED (write)
|
||||||
]
|
]
|
||||||
with mock.patch("builtins.open", m_open):
|
with mock.patch("builtins.open", m_open):
|
||||||
with mock.patch("config_generator.Environment"):
|
with mock.patch("planoai.config_generator.Environment"):
|
||||||
if expected_error:
|
if expected_error:
|
||||||
# Test expects an error
|
# Test expects an error
|
||||||
with pytest.raises(Exception) as excinfo:
|
with pytest.raises(Exception) as excinfo:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue