test: 补充缺失的核心模块测试,统一CLI测试行为
新增测试文件: - tests/test_core/test_parser.py - 测试 parse_input/process_content/output_result - tests/test_core/test_markdown_extra.py - 测试 extract_title_content/search_markdown - tests/test_utils/test_encoding_detection.py - 测试编码检测模块 - tests/test_readers/test_html_downloader.py - 测试HTML下载器 修改: - tests/conftest.py - 移除pytest.skip(),所有CLI测试在缺少依赖时直接失败(与HTML测试行为一致)
This commit is contained in:
@@ -51,10 +51,7 @@ def temp_docx(tmp_path):
|
||||
str: 临时文件路径
|
||||
"""
|
||||
def _create_docx(paragraphs=None, headings=None, table_data=None, list_items=None):
|
||||
try:
|
||||
from docx import Document
|
||||
except ImportError:
|
||||
pytest.skip("python-docx 未安装")
|
||||
from docx import Document
|
||||
|
||||
doc = Document()
|
||||
|
||||
@@ -99,13 +96,10 @@ def temp_pdf(tmp_path):
|
||||
str: 临时文件路径
|
||||
"""
|
||||
def _create_pdf(text=None, lines=None):
|
||||
try:
|
||||
from reportlab.pdfgen import canvas
|
||||
from reportlab.lib.pagesizes import letter
|
||||
from reportlab.pdfbase import pdfmetrics
|
||||
from reportlab.pdfbase.ttfonts import TTFont
|
||||
except ImportError:
|
||||
pytest.skip("reportlab 未安装")
|
||||
from reportlab.pdfgen import canvas
|
||||
from reportlab.lib.pagesizes import letter
|
||||
from reportlab.pdfbase import pdfmetrics
|
||||
from reportlab.pdfbase.ttfonts import TTFont
|
||||
|
||||
file_path = tmp_path / "test.pdf"
|
||||
c = canvas.Canvas(str(file_path), pagesize=letter)
|
||||
@@ -176,10 +170,7 @@ def temp_pptx(tmp_path):
|
||||
str: 临时文件路径
|
||||
"""
|
||||
def _create_pptx(slides=None):
|
||||
try:
|
||||
from pptx import Presentation
|
||||
except ImportError:
|
||||
pytest.skip("python-pptx 未安装")
|
||||
from pptx import Presentation
|
||||
|
||||
prs = Presentation()
|
||||
|
||||
@@ -209,10 +200,7 @@ def temp_xlsx(tmp_path):
|
||||
str: 临时文件路径
|
||||
"""
|
||||
def _create_xlsx(data=None):
|
||||
try:
|
||||
import pandas as pd
|
||||
except ImportError:
|
||||
pytest.skip("pandas 未安装")
|
||||
import pandas as pd
|
||||
|
||||
file_path = tmp_path / "test.xlsx"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user