more debug info
Some checks failed
Python CI / test (3.12) (push) Failing after 6m22s
Python CI / test (3.13) (push) Failing after 6m22s

This commit is contained in:
Duncan Tourolle 2025-11-09 15:30:10 +01:00
parent 472606dfa5
commit b2ede1c481

View File

@ -24,21 +24,54 @@ class TestSettingsOverlay(unittest.TestCase):
def setUp(self):
"""Set up test reader with a book"""
import os
import zipfile
self.reader = EbookReader(page_size=(800, 1200))
# Load a test EPUB
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'
epubs = list(epub_dir.glob('*.epub'))
if epubs:
test_epub = epubs[0]
else:
self.skipTest("No test EPUB files available")
# Load a test EPUB - use any available EPUB in test data
epub_dir = Path(__file__).parent / 'data' / 'library-epub'
epubs = list(epub_dir.glob('*.epub'))
if not epubs:
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))
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):
"""Clean up"""