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:
@@ -14,9 +14,9 @@ from pathlib import Path
|
||||
from typing import Dict, Any
|
||||
from datetime import datetime
|
||||
|
||||
from kb_pipeline.pipeline import Pipeline
|
||||
from kb_pipeline.schemas import PipelineConfig, PipelineOutput, WorkflowState
|
||||
from kb_pipeline.state import WorkflowStateManager
|
||||
from kb_workflow.pipeline.pipeline import Pipeline
|
||||
from kb_workflow.pipeline.schemas import PipelineConfig, PipelineOutput, WorkflowState
|
||||
from kb_workflow.pipeline.state import WorkflowStateManager
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -93,14 +93,14 @@ class TestFullWorkflowExecution:
|
||||
@pytest.mark.asyncio
|
||||
async def test_full_workflow_executes_successfully(self, temp_content_dir, mock_processors):
|
||||
"""Test that full workflow executes from URL to analysis."""
|
||||
from kb_pipeline.schemas import PipelineConfig
|
||||
from kb_workflow.pipeline.schemas import PipelineConfig
|
||||
|
||||
config = PipelineConfig(
|
||||
steps=["parse", "download", "asr", "analyze"],
|
||||
output_dir=temp_content_dir,
|
||||
)
|
||||
|
||||
with patch("kb_pipeline.pipeline.get_settings") as mock_settings:
|
||||
with patch("kb_workflow.pipeline.pipeline.get_settings") as mock_settings:
|
||||
mock_settings.return_value = MagicMock()
|
||||
|
||||
pipeline = Pipeline(
|
||||
@@ -118,14 +118,14 @@ class TestFullWorkflowExecution:
|
||||
@pytest.mark.asyncio
|
||||
async def test_workflow_creates_content_directory(self, temp_content_dir, mock_processors):
|
||||
"""Test that workflow creates content directory with correct naming."""
|
||||
from kb_pipeline.schemas import PipelineConfig
|
||||
from kb_workflow.pipeline.schemas import PipelineConfig
|
||||
|
||||
config = PipelineConfig(
|
||||
steps=["parse"],
|
||||
output_dir=temp_content_dir,
|
||||
)
|
||||
|
||||
with patch("kb_pipeline.pipeline.get_settings") as mock_settings:
|
||||
with patch("kb_workflow.pipeline.pipeline.get_settings") as mock_settings:
|
||||
mock_settings.return_value = MagicMock()
|
||||
|
||||
pipeline = Pipeline(
|
||||
@@ -147,7 +147,7 @@ class TestWorkflowErrorHandling:
|
||||
@pytest.mark.asyncio
|
||||
async def test_workflow_handles_errors_gracefully(self, temp_content_dir):
|
||||
"""Test that workflow handles errors gracefully."""
|
||||
from kb_pipeline.schemas import PipelineConfig
|
||||
from kb_workflow.pipeline.schemas import PipelineConfig
|
||||
|
||||
# Create processor that fails
|
||||
failing_processor = MagicMock()
|
||||
@@ -162,7 +162,7 @@ class TestWorkflowErrorHandling:
|
||||
output_dir=temp_content_dir,
|
||||
)
|
||||
|
||||
with patch("kb_pipeline.pipeline.get_settings") as mock_settings:
|
||||
with patch("kb_workflow.pipeline.pipeline.get_settings") as mock_settings:
|
||||
mock_settings.return_value = MagicMock()
|
||||
|
||||
pipeline = Pipeline(
|
||||
@@ -179,14 +179,14 @@ class TestWorkflowErrorHandling:
|
||||
@pytest.mark.asyncio
|
||||
async def test_workflow_handles_invalid_url(self, temp_content_dir):
|
||||
"""Test that workflow handles invalid URL."""
|
||||
from kb_pipeline.schemas import PipelineConfig
|
||||
from kb_workflow.pipeline.schemas import PipelineConfig
|
||||
|
||||
config = PipelineConfig(
|
||||
steps=["parse"],
|
||||
output_dir=temp_content_dir,
|
||||
)
|
||||
|
||||
with patch("kb_pipeline.pipeline.get_settings") as mock_settings:
|
||||
with patch("kb_workflow.pipeline.pipeline.get_settings") as mock_settings:
|
||||
mock_settings.return_value = MagicMock()
|
||||
|
||||
# Empty processor list - pipeline will fail to parse URL
|
||||
@@ -271,7 +271,7 @@ class TestWorkflowResumability:
|
||||
@pytest.mark.asyncio
|
||||
async def test_workflow_skips_completed_steps(self, temp_content_dir):
|
||||
"""Test that workflow can resume (skip completed steps)."""
|
||||
from kb_pipeline.schemas import PipelineConfig
|
||||
from kb_workflow.pipeline.schemas import PipelineConfig
|
||||
|
||||
# Create state with parse already completed
|
||||
state_manager = WorkflowStateManager(temp_content_dir)
|
||||
@@ -303,7 +303,7 @@ class TestWorkflowResumability:
|
||||
skip_completed=True,
|
||||
)
|
||||
|
||||
with patch("kb_pipeline.pipeline.get_settings") as mock_settings:
|
||||
with patch("kb_workflow.pipeline.pipeline.get_settings") as mock_settings:
|
||||
mock_settings.return_value = MagicMock(intermediate_path=str(temp_content_dir))
|
||||
|
||||
pipeline = Pipeline(
|
||||
@@ -324,7 +324,7 @@ class TestWorkflowResumability:
|
||||
@pytest.mark.asyncio
|
||||
async def test_workflow_reruns_all_steps_when_skip_disabled(self, temp_content_dir):
|
||||
"""Test that workflow re-runs all steps when skip_completed is False."""
|
||||
from kb_pipeline.schemas import PipelineConfig
|
||||
from kb_workflow.pipeline.schemas import PipelineConfig
|
||||
|
||||
# Create processors
|
||||
parse_processor = MagicMock()
|
||||
@@ -337,7 +337,7 @@ class TestWorkflowResumability:
|
||||
skip_completed=False, # Disable skip
|
||||
)
|
||||
|
||||
with patch("kb_pipeline.pipeline.get_settings") as mock_settings:
|
||||
with patch("kb_workflow.pipeline.pipeline.get_settings") as mock_settings:
|
||||
mock_settings.return_value = MagicMock()
|
||||
|
||||
pipeline = Pipeline(
|
||||
|
||||
Reference in New Issue
Block a user