more debug info
This commit is contained in:
parent
472606dfa5
commit
b2ede1c481
@ -24,21 +24,54 @@ class TestSettingsOverlay(unittest.TestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""Set up test reader with a book"""
|
"""Set up test reader with a book"""
|
||||||
|
import os
|
||||||
|
import zipfile
|
||||||
|
|
||||||
self.reader = EbookReader(page_size=(800, 1200))
|
self.reader = EbookReader(page_size=(800, 1200))
|
||||||
|
|
||||||
# Load a test EPUB
|
# Load a test EPUB - use any available EPUB in test data
|
||||||
test_epub = Path(__file__).parent / 'data' / 'library-epub' / 'alice.epub'
|
|
||||||
if not test_epub.exists():
|
|
||||||
# Try to find any EPUB in test data
|
|
||||||
epub_dir = Path(__file__).parent / 'data' / 'library-epub'
|
epub_dir = Path(__file__).parent / 'data' / 'library-epub'
|
||||||
epubs = list(epub_dir.glob('*.epub'))
|
epubs = list(epub_dir.glob('*.epub'))
|
||||||
if epubs:
|
if not epubs:
|
||||||
test_epub = epubs[0]
|
|
||||||
else:
|
|
||||||
self.skipTest("No test EPUB files available")
|
self.skipTest("No test EPUB files available")
|
||||||
|
|
||||||
|
test_epub = epubs[0]
|
||||||
|
|
||||||
|
# Debug logging
|
||||||
|
print(f"\n=== EPUB Loading Debug Info ===")
|
||||||
|
print(f"Test EPUB path: {test_epub}")
|
||||||
|
print(f"Absolute path: {test_epub.absolute()}")
|
||||||
|
print(f"File exists: {test_epub.exists()}")
|
||||||
|
print(f"File size: {test_epub.stat().st_size if test_epub.exists() else 'N/A'}")
|
||||||
|
print(f"Is file: {test_epub.is_file() if test_epub.exists() else 'N/A'}")
|
||||||
|
print(f"Readable: {os.access(test_epub, os.R_OK) if test_epub.exists() else 'N/A'}")
|
||||||
|
|
||||||
|
# Test if it's a valid ZIP
|
||||||
|
if test_epub.exists():
|
||||||
|
try:
|
||||||
|
with zipfile.ZipFile(test_epub, 'r') as zf:
|
||||||
|
print(f"Valid ZIP: True")
|
||||||
|
print(f"Files in ZIP: {len(zf.namelist())}")
|
||||||
|
print(f"First 3 files: {zf.namelist()[:3]}")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"ZIP validation error: {e}")
|
||||||
|
|
||||||
|
# Try to load
|
||||||
success = self.reader.load_epub(str(test_epub))
|
success = self.reader.load_epub(str(test_epub))
|
||||||
self.assertTrue(success, "Failed to load test EPUB")
|
|
||||||
|
if not success:
|
||||||
|
print(f"=== Load failed ===")
|
||||||
|
# Try loading with pyWebLayout directly for more detailed error
|
||||||
|
try:
|
||||||
|
from pyWebLayout.io.readers.epub_reader import read_epub
|
||||||
|
book = read_epub(str(test_epub))
|
||||||
|
print(f"Direct pyWebLayout load: SUCCESS (unexpected!)")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Direct pyWebLayout load error: {e}")
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
|
self.assertTrue(success, f"Failed to load test EPUB: {test_epub}")
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
"""Clean up"""
|
"""Clean up"""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user