refactor(06-02): update CLI and test imports to kb_workflow.pipeline
- Remove sys.path manipulation from kb_workflow.py - Update CLI imports to use kb_workflow.pipeline prefix - Update all test file imports and patch paths Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,7 @@ from pathlib import Path
|
||||
from dataclasses import dataclass, field
|
||||
from typing import List
|
||||
|
||||
from kb_pipeline.schemas import AnalyzeInput, AnalyzeOutput
|
||||
from kb_workflow.pipeline.schemas import AnalyzeInput, AnalyzeOutput
|
||||
|
||||
|
||||
# Mock AnalysisResult for testing
|
||||
@@ -213,8 +213,8 @@ class TestAnalyzeProcessorIntegration:
|
||||
self, mock_analysis_result, mock_state_manager, sample_metadata, sample_content, tmp_path
|
||||
):
|
||||
"""Test 1: AnalyzeProcessor loads metadata and content from files"""
|
||||
from kb_pipeline.processors.analyze import AnalyzeProcessor
|
||||
from kb_pipeline.schemas import AnalyzeInput
|
||||
from kb_workflow.pipeline.processors.analyze import AnalyzeProcessor
|
||||
from kb_workflow.pipeline.schemas import AnalyzeInput
|
||||
|
||||
output_file = str(tmp_path / "bilibili_BV1xx_analysis.md")
|
||||
|
||||
@@ -227,7 +227,7 @@ class TestAnalyzeProcessorIntegration:
|
||||
output_file=output_file
|
||||
)
|
||||
|
||||
with patch("kb_pipeline.processors.base.get_settings") as mock_settings:
|
||||
with patch("kb_workflow.pipeline.processors.base.get_settings") as mock_settings:
|
||||
mock_settings.return_value = MagicMock()
|
||||
processor = AnalyzeProcessor(state_manager=mock_state_manager)
|
||||
|
||||
@@ -251,8 +251,8 @@ class TestAnalyzeProcessorIntegration:
|
||||
self, mock_analysis_result, mock_state_manager, sample_metadata, sample_content, tmp_path
|
||||
):
|
||||
"""Test 2: AnalyzeProcessor calls DeepAnalyzer.analyze() with correct parameters"""
|
||||
from kb_pipeline.processors.analyze import AnalyzeProcessor
|
||||
from kb_pipeline.schemas import AnalyzeInput
|
||||
from kb_workflow.pipeline.processors.analyze import AnalyzeProcessor
|
||||
from kb_workflow.pipeline.schemas import AnalyzeInput
|
||||
|
||||
output_file = str(tmp_path / "bilibili_BV1xx_analysis.md")
|
||||
|
||||
@@ -265,7 +265,7 @@ class TestAnalyzeProcessorIntegration:
|
||||
output_file=output_file
|
||||
)
|
||||
|
||||
with patch("kb_pipeline.processors.base.get_settings") as mock_settings:
|
||||
with patch("kb_workflow.pipeline.processors.base.get_settings") as mock_settings:
|
||||
mock_settings.return_value = MagicMock()
|
||||
processor = AnalyzeProcessor(state_manager=mock_state_manager)
|
||||
|
||||
@@ -291,8 +291,8 @@ class TestAnalyzeProcessorIntegration:
|
||||
self, mock_analysis_result, mock_state_manager, sample_metadata, sample_content, tmp_path
|
||||
):
|
||||
"""Test 3: AnalyzeProcessor saves analysis report as Markdown"""
|
||||
from kb_pipeline.processors.analyze import AnalyzeProcessor
|
||||
from kb_pipeline.schemas import AnalyzeInput
|
||||
from kb_workflow.pipeline.processors.analyze import AnalyzeProcessor
|
||||
from kb_workflow.pipeline.schemas import AnalyzeInput
|
||||
|
||||
output_file = str(tmp_path / "bilibili_BV1xx_analysis.md")
|
||||
|
||||
@@ -305,7 +305,7 @@ class TestAnalyzeProcessorIntegration:
|
||||
output_file=output_file
|
||||
)
|
||||
|
||||
with patch("kb_pipeline.processors.base.get_settings") as mock_settings:
|
||||
with patch("kb_workflow.pipeline.processors.base.get_settings") as mock_settings:
|
||||
mock_settings.return_value = MagicMock()
|
||||
processor = AnalyzeProcessor(state_manager=mock_state_manager)
|
||||
|
||||
@@ -338,8 +338,8 @@ class TestAnalyzeProcessorIntegration:
|
||||
self, mock_analysis_result, mock_state_manager, sample_metadata, sample_content, tmp_path
|
||||
):
|
||||
"""Test 4: AnalyzeProcessor records state on success"""
|
||||
from kb_pipeline.processors.analyze import AnalyzeProcessor
|
||||
from kb_pipeline.schemas import AnalyzeInput, WorkflowState
|
||||
from kb_workflow.pipeline.processors.analyze import AnalyzeProcessor
|
||||
from kb_workflow.pipeline.schemas import AnalyzeInput, WorkflowState
|
||||
|
||||
# Create a mock state that will be updated
|
||||
mock_state = MagicMock(spec=WorkflowState)
|
||||
@@ -357,7 +357,7 @@ class TestAnalyzeProcessorIntegration:
|
||||
output_file=output_file
|
||||
)
|
||||
|
||||
with patch("kb_pipeline.processors.base.get_settings") as mock_settings:
|
||||
with patch("kb_workflow.pipeline.processors.base.get_settings") as mock_settings:
|
||||
mock_settings.return_value = MagicMock()
|
||||
processor = AnalyzeProcessor(state_manager=mock_state_manager)
|
||||
|
||||
@@ -381,8 +381,8 @@ class TestAnalyzeProcessorIntegration:
|
||||
self, mock_state_manager, sample_metadata, sample_content, tmp_path
|
||||
):
|
||||
"""Test 5: AnalyzeProcessor records state on failure"""
|
||||
from kb_pipeline.processors.analyze import AnalyzeProcessor
|
||||
from kb_pipeline.schemas import AnalyzeInput, WorkflowState
|
||||
from kb_workflow.pipeline.processors.analyze import AnalyzeProcessor
|
||||
from kb_workflow.pipeline.schemas import AnalyzeInput, WorkflowState
|
||||
|
||||
# Create a mock state that will be updated
|
||||
mock_state = MagicMock(spec=WorkflowState)
|
||||
@@ -400,7 +400,7 @@ class TestAnalyzeProcessorIntegration:
|
||||
output_file=output_file
|
||||
)
|
||||
|
||||
with patch("kb_pipeline.processors.base.get_settings") as mock_settings:
|
||||
with patch("kb_workflow.pipeline.processors.base.get_settings") as mock_settings:
|
||||
mock_settings.return_value = MagicMock()
|
||||
processor = AnalyzeProcessor(state_manager=mock_state_manager)
|
||||
|
||||
@@ -424,8 +424,8 @@ class TestAnalyzeProcessorModuleExport:
|
||||
"""Tests for AnalyzeProcessor module export."""
|
||||
|
||||
def test_analyze_processor_importable_from_processors(self):
|
||||
"""Test: AnalyzeProcessor can be imported from kb_pipeline.processors"""
|
||||
from kb_pipeline.processors import AnalyzeProcessor
|
||||
"""Test: AnalyzeProcessor can be imported from kb_workflow.pipeline.processors"""
|
||||
from kb_workflow.pipeline.processors import AnalyzeProcessor
|
||||
|
||||
assert AnalyzeProcessor is not None
|
||||
assert hasattr(AnalyzeProcessor, 'STEP_NAME')
|
||||
|
||||
Reference in New Issue
Block a user