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:
2026-03-17 00:17:10 +08:00
parent fdca690bd6
commit c9ca1b538d
20 changed files with 307 additions and 307 deletions
+8 -8
View File
@@ -15,7 +15,7 @@ class TestIdempotencyChecker:
def test_check_exists_returns_true_when_files_exist(self, tmp_path):
"""Test 1: 文件存在时 check_exists 返回 (True, [file_list])"""
from kb_pipeline.idempotency import IdempotencyChecker
from kb_workflow.pipeline.idempotency import IdempotencyChecker
# Create output directory with expected files
output_dir = tmp_path / "bilibili"
@@ -41,7 +41,7 @@ class TestIdempotencyChecker:
def test_check_exists_returns_false_when_files_not_exist(self, tmp_path):
"""Test 2: 文件不存在时 check_exists 返回 (False, [])"""
from kb_pipeline.idempotency import IdempotencyChecker
from kb_workflow.pipeline.idempotency import IdempotencyChecker
output_dir = tmp_path / "bilibili"
output_dir.mkdir()
@@ -57,7 +57,7 @@ class TestIdempotencyChecker:
def test_check_exists_returns_partial_files_when_some_exist(self, tmp_path):
"""Test 3: 部分文件存在时返回正确的存在文件列表"""
from kb_pipeline.idempotency import IdempotencyChecker
from kb_workflow.pipeline.idempotency import IdempotencyChecker
output_dir = tmp_path / "zhihu"
output_dir.mkdir()
@@ -80,7 +80,7 @@ class TestIdempotencyChecker:
def test_check_exists_creates_directory_if_not_exists(self, tmp_path):
"""如果输出目录不存在,check_exists 应该返回 False"""
from kb_pipeline.idempotency import IdempotencyChecker
from kb_workflow.pipeline.idempotency import IdempotencyChecker
output_dir = tmp_path / "new_platform" # Directory doesn't exist
content_id = "BV1test123"
@@ -98,7 +98,7 @@ class TestIdempotencyCheckerFileNaming:
def test_bilibili_file_naming(self, tmp_path):
"""测试B站文件的命名格式"""
from kb_pipeline.idempotency import IdempotencyChecker
from kb_workflow.pipeline.idempotency import IdempotencyChecker
output_dir = tmp_path / "bilibili"
output_dir.mkdir()
@@ -121,7 +121,7 @@ class TestIdempotencyCheckerFileNaming:
def test_zhihu_file_naming(self, tmp_path):
"""测试知乎文件的命名格式"""
from kb_pipeline.idempotency import IdempotencyChecker
from kb_workflow.pipeline.idempotency import IdempotencyChecker
output_dir = tmp_path / "zhihu"
output_dir.mkdir()
@@ -148,7 +148,7 @@ class TestIdempotencyCheckerEdgeCases:
def test_check_exists_with_empty_content_id(self, tmp_path):
"""空content_id应该返回False"""
from kb_pipeline.idempotency import IdempotencyChecker
from kb_workflow.pipeline.idempotency import IdempotencyChecker
output_dir = tmp_path / "bilibili"
output_dir.mkdir()
@@ -161,7 +161,7 @@ class TestIdempotencyCheckerEdgeCases:
def test_check_exists_with_special_characters_in_id(self, tmp_path):
"""ID中包含特殊字符时的处理"""
from kb_pipeline.idempotency import IdempotencyChecker
from kb_workflow.pipeline.idempotency import IdempotencyChecker
output_dir = tmp_path / "bilibili"
output_dir.mkdir()