fix all tests
Python CI / test (push) Failing after 7m0s

This commit is contained in:
2025-10-06 22:28:48 +02:00
parent 718027f3c8
commit fdb3023919
10 changed files with 389 additions and 54 deletions
+35 -36
View File
@@ -307,7 +307,8 @@ class TestEreaderLayoutManager(unittest.TestCase):
manager = EreaderLayoutManager(
self.blocks,
self.page_size,
self.document_id
self.document_id,
bookmarks_dir=self.temp_dir
)
self.assertEqual(manager.page_size, self.page_size)
@@ -329,7 +330,8 @@ class TestEreaderLayoutManager(unittest.TestCase):
manager = EreaderLayoutManager(
self.blocks,
self.page_size,
self.document_id
self.document_id,
bookmarks_dir=self.temp_dir
)
# Test initial scale
@@ -354,7 +356,8 @@ class TestEreaderLayoutManager(unittest.TestCase):
manager = EreaderLayoutManager(
self.blocks,
self.page_size,
self.document_id
self.document_id,
bookmarks_dir=self.temp_dir
)
toc = manager.get_table_of_contents()
@@ -371,37 +374,31 @@ class TestEreaderLayoutManager(unittest.TestCase):
def test_bookmark_functionality(self):
"""Test bookmark functionality"""
original_cwd = Path.cwd()
try:
import os
os.chdir(self.temp_dir)
manager = EreaderLayoutManager(
self.blocks,
self.page_size,
self.document_id
)
# Add bookmark
success = manager.add_bookmark("test_bookmark")
self.assertTrue(success)
# List bookmarks
bookmarks = manager.list_bookmarks()
self.assertEqual(len(bookmarks), 1)
self.assertEqual(bookmarks[0][0], "test_bookmark")
# Jump to bookmark (should work even though it's the same position)
page = manager.jump_to_bookmark("test_bookmark")
self.assertIsNotNone(page)
# Remove bookmark
success = manager.remove_bookmark("test_bookmark")
self.assertTrue(success)
manager.shutdown()
finally:
os.chdir(original_cwd)
manager = EreaderLayoutManager(
self.blocks,
self.page_size,
self.document_id,
bookmarks_dir=self.temp_dir
)
# Add bookmark
success = manager.add_bookmark("test_bookmark")
self.assertTrue(success)
# List bookmarks
bookmarks = manager.list_bookmarks()
self.assertEqual(len(bookmarks), 1)
self.assertEqual(bookmarks[0][0], "test_bookmark")
# Jump to bookmark (should work even though it's the same position)
page = manager.jump_to_bookmark("test_bookmark")
self.assertIsNotNone(page)
# Remove bookmark
success = manager.remove_bookmark("test_bookmark")
self.assertTrue(success)
manager.shutdown()
def test_progress_tracking(self):
"""Test reading progress tracking"""
@@ -413,7 +410,8 @@ class TestEreaderLayoutManager(unittest.TestCase):
manager = EreaderLayoutManager(
self.blocks,
self.page_size,
self.document_id
self.document_id,
bookmarks_dir=self.temp_dir
)
# Initial progress should be 0
@@ -441,7 +439,8 @@ class TestEreaderLayoutManager(unittest.TestCase):
manager = create_ereader_manager(
self.blocks,
self.page_size,
self.document_id
self.document_id,
bookmarks_dir=self.temp_dir
)
self.assertIsInstance(manager, EreaderLayoutManager)