mirror of
https://github.com/DS4SD/docling.git
synced 2025-12-08 20:58:11 +00:00
chore: Safer unloading of DPv4 backend (#1867)
fix: Safer unloading of DPv4 backend Signed-off-by: Christoph Auer <cau@zurich.ibm.com>
This commit is contained in:
@@ -46,6 +46,12 @@ def test_text_cell_counts():
|
||||
)
|
||||
last_cell_count = len(cells)
|
||||
|
||||
# Clean up page backend after each iteration
|
||||
page_backend.unload()
|
||||
|
||||
# Explicitly clean up document backend to prevent race conditions in CI
|
||||
doc_backend.unload()
|
||||
|
||||
|
||||
def test_get_text_from_rect(test_doc_path):
|
||||
doc_backend = _get_backend(test_doc_path)
|
||||
@@ -59,6 +65,10 @@ def test_get_text_from_rect(test_doc_path):
|
||||
|
||||
assert textpiece.strip() == ref
|
||||
|
||||
# Explicitly clean up resources
|
||||
page_backend.unload()
|
||||
doc_backend.unload()
|
||||
|
||||
|
||||
def test_crop_page_image(test_doc_path):
|
||||
doc_backend = _get_backend(test_doc_path)
|
||||
@@ -70,7 +80,14 @@ def test_crop_page_image(test_doc_path):
|
||||
)
|
||||
# im.show()
|
||||
|
||||
# Explicitly clean up resources
|
||||
page_backend.unload()
|
||||
doc_backend.unload()
|
||||
|
||||
|
||||
def test_num_pages(test_doc_path):
|
||||
doc_backend = _get_backend(test_doc_path)
|
||||
doc_backend.page_count() == 9
|
||||
|
||||
# Explicitly clean up resources to prevent race conditions in CI
|
||||
doc_backend.unload()
|
||||
|
||||
Reference in New Issue
Block a user