mirror of
https://github.com/Azure-Samples/graphrag-accelerator.git
synced 2025-07-06 16:47:31 +00:00
55 lines
1.6 KiB
Python
55 lines
1.6 KiB
Python
![]() |
from unittest.mock import patch
|
||
|
|
||
|
import pytest
|
||
|
|
||
|
from src.logger.load_logger import load_pipeline_logger
|
||
|
|
||
|
|
||
|
@pytest.fixture
|
||
|
def mock_app_insights_workflow_callbacks():
|
||
|
with patch(
|
||
|
"src.logger.application_insights_workflow_callbacks.ApplicationInsightsWorkflowCallbacks"
|
||
|
) as mock_app_insights_workflow_callbacks:
|
||
|
yield mock_app_insights_workflow_callbacks
|
||
|
|
||
|
|
||
|
@pytest.fixture
|
||
|
def mock_file_workflow_callbacks():
|
||
|
with patch(
|
||
|
"graphrag.index.reporting.file_workflow_callbacks.FileWorkflowCallbacks"
|
||
|
) as mock_file_workflow_callbacks:
|
||
|
yield mock_file_workflow_callbacks
|
||
|
|
||
|
|
||
|
@pytest.fixture
|
||
|
def mock_blob_workflow_callbacks():
|
||
|
with patch(
|
||
|
"src.logger.blob_workflow_callbacks.BlobWorkflowCallbacks"
|
||
|
) as mock_blob_workflow_callbacks:
|
||
|
yield mock_blob_workflow_callbacks
|
||
|
|
||
|
|
||
|
@pytest.fixture
|
||
|
def mock_console_workflow_callbacks():
|
||
|
with patch(
|
||
|
"src.logger.console_workflow_callbacks.ConsoleWorkflowCallbacks"
|
||
|
) as mock_console_workflow_callbacks:
|
||
|
yield mock_console_workflow_callbacks
|
||
|
|
||
|
|
||
|
@pytest.mark.skip(reason="This test is currently not complete")
|
||
|
def test_load_pipeline_logger_with_console(
|
||
|
mock_app_insights_workflow_callbacks,
|
||
|
mock_blob_workflow_callbacks,
|
||
|
mock_console_workflow_callbacks,
|
||
|
mock_file_workflow_callbacks,
|
||
|
):
|
||
|
"""Test load_pipeline_logger."""
|
||
|
loggers = load_pipeline_logger(
|
||
|
reporting_dir="logs",
|
||
|
reporters=["app_insights", "blob", "console", "file"],
|
||
|
index_name="test-index",
|
||
|
num_workflow_steps=4,
|
||
|
)
|
||
|
assert len(loggers._callbacks) == 4
|