mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-24 15:48:23 +00:00
fix: raise ImportError during PDFKnowledgeSource instantiation when pdfplumber is missing
- Add __init__ method to PDFKnowledgeSource that checks PDFPLUMBER_AVAILABLE - Update test_optional_dependencies.py to expect ImportError during instantiation - Fixes test_optional_pdf_import_error in test_lite_installation.py - Ensures consistent behavior across all optional dependency implementations Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
@@ -44,10 +44,8 @@ class TestOptionalDependencies:
|
||||
test_file.touch()
|
||||
|
||||
try:
|
||||
pdf_source = PDFKnowledgeSource(file_paths=["test.pdf"])
|
||||
|
||||
with pytest.raises(ImportError) as exc_info:
|
||||
pdf_source._import_pdfplumber()
|
||||
PDFKnowledgeSource(file_paths=["test.pdf"])
|
||||
|
||||
assert "pdfplumber is required" in str(exc_info.value)
|
||||
assert "crewai[knowledge]" in str(exc_info.value)
|
||||
|
||||
Reference in New Issue
Block a user