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:
Christoph Auer
2025-06-30 14:41:21 +02:00
committed by GitHub
parent ae39a9411a
commit bdfee4e2d0
3 changed files with 1262 additions and 344 deletions

View File

@@ -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()