Fix all tests: 297/297 passing, 0 skipped, 0 failed

CHANGES:

1. **Fixed 9 PDF Scraper Test Failures:**
   - Added .get() safety for missing page keys (headings, text, code_blocks, images)
   - Supported both 'code_samples' and 'code_blocks' keys for compatibility
   - Fixed extract_pdf() to raise RuntimeError on failure (tests expect exception)
   - Added image saving functionality to _generate_reference_file()
   - Updated all test methods to override skill_dir with temp directory
   - Fixed categorization to handle pre-categorized test data

2. **Fixed 25 MCP Test Skips:**
   - Renamed mcp/ directory to skill_seeker_mcp/ to avoid shadowing external mcp package
   - Updated all imports in tests/test_mcp_server.py
   - Simplified skill_seeker_mcp/server.py import logic (no more shadowing workarounds)
   - Updated tests/test_package_structure.py to reference skill_seeker_mcp

3. **Test Results:**
   -  297 tests passing (100%)
   -  0 tests skipped
   -  0 tests failed
   - All test categories passing:
     * 23 package structure tests
     * 18 PDF scraper tests
     * 67 PDF extractor/advanced tests
     * 25 MCP server tests
     * 164 other core tests

BREAKING CHANGE: MCP server directory renamed from `mcp/` to `skill_seeker_mcp/`

📦 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
yusyus
2025-10-26 00:51:18 +03:00
parent e1e91afba2
commit 7cc3d8b175
9 changed files with 140 additions and 112 deletions

View File

@@ -211,6 +211,9 @@ class TestSkillBuilding(unittest.TestCase):
}
converter = self.PDFToSkillConverter(config)
# Override skill_dir to use temp directory
converter.skill_dir = str(Path(self.temp_dir) / "test_skill")
# Mock extracted data
converter.extracted_data = {
"pages": [
@@ -247,6 +250,9 @@ class TestSkillBuilding(unittest.TestCase):
}
converter = self.PDFToSkillConverter(config)
# Override skill_dir to use temp directory
converter.skill_dir = str(Path(self.temp_dir) / "test_skill")
converter.extracted_data = {
"pages": [{"page_number": 1, "text": "Test", "code_blocks": [], "images": []}],
"total_pages": 1
@@ -271,6 +277,9 @@ class TestSkillBuilding(unittest.TestCase):
}
converter = self.PDFToSkillConverter(config)
# Override skill_dir to use temp directory
converter.skill_dir = str(Path(self.temp_dir) / "test_skill")
converter.extracted_data = {
"pages": [
{"page_number": 1, "text": "Getting started", "code_blocks": [], "images": []},
@@ -314,6 +323,9 @@ class TestCodeBlockHandling(unittest.TestCase):
}
converter = self.PDFToSkillConverter(config)
# Override skill_dir to use temp directory
converter.skill_dir = str(Path(self.temp_dir) / "test_skill")
# Mock data with code blocks
converter.extracted_data = {
"pages": [
@@ -355,6 +367,9 @@ class TestCodeBlockHandling(unittest.TestCase):
}
converter = self.PDFToSkillConverter(config)
# Override skill_dir to use temp directory
converter.skill_dir = str(Path(self.temp_dir) / "test_skill")
# Mock data with varying quality
converter.extracted_data = {
"pages": [
@@ -402,6 +417,9 @@ class TestImageHandling(unittest.TestCase):
}
converter = self.PDFToSkillConverter(config)
# Override skill_dir to use temp directory
converter.skill_dir = str(Path(self.temp_dir) / "test_skill")
# Mock image data (1x1 white PNG)
mock_image_bytes = b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x01\x00\x00\x00\x01\x08\x06\x00\x00\x00\x1f\x15\xc4\x89\x00\x00\x00\nIDATx\x9cc\x00\x01\x00\x00\x05\x00\x01\r\n-\xb4\x00\x00\x00\x00IEND\xaeB`\x82'
@@ -441,6 +459,9 @@ class TestImageHandling(unittest.TestCase):
}
converter = self.PDFToSkillConverter(config)
# Override skill_dir to use temp directory
converter.skill_dir = str(Path(self.temp_dir) / "test_skill")
mock_image_bytes = b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x01\x00\x00\x00\x01\x08\x06\x00\x00\x00\x1f\x15\xc4\x89\x00\x00\x00\nIDATx\x9cc\x00\x01\x00\x00\x05\x00\x01\r\n-\xb4\x00\x00\x00\x00IEND\xaeB`\x82'
converter.extracted_data = {