From 1c84ade02e40a4054529b10c1f8623fab338916d Mon Sep 17 00:00:00 2001 From: MaxNumerique Date: Thu, 26 Nov 2026 12:07:28 +0100 Subject: [PATCH 1/4] fix(tests): wait for the background native save before reloading the native file The native file is saved in background: reloading it right after generate_files_from_file failed when the save thread had not finished. Closes #307 Co-Authored-By: Claude Opus 5.5 --- tests/test_utils_functions.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_utils_functions.py b/tests/test_utils_functions.py index ea6e85c7..d67f0937 100644 --- a/tests/test_utils_functions.py +++ b/tests/test_utils_functions.py @@ -347,6 +347,8 @@ def test_generate_files_from_non_native_file_twice_shares_geode_id( ) # An unnamed single object takes the file stem assert first["name"] == "hat" + # The native file is saved in background + utils_functions.wait_native_saved(first["id"]) native_path = geode_functions.data_file_path(first["id"], first["native_file"]) reloaded = GeodePolygonalSurface3D.load_one(native_path) assert reloaded.identifier.id().string() == first["geode_id"] @@ -410,6 +412,8 @@ def test_generate_files_from_multi_object_file(client: FlaskClient) -> None: data = Data.get(item["id"]) assert data is not None assert data.geode_id == item["geode_id"] + # The native file is saved in background + utils_functions.wait_native_saved(item["id"]) native_path = geode_functions.data_file_path(item["id"], item["native_file"]) reloaded = GeodeTriangulatedSurface3D.load_one(native_path) assert reloaded.identifier.id().string() == item["geode_id"] From 6da4b189c0cb1819cc9f91a85f179b794ba55e1b Mon Sep 17 00:00:00 2001 From: MaxNumerique <144453705+MaxNumerique@users.noreply.github.com> Date: Thu, 26 Nov 2026 11:08:18 +0000 Subject: [PATCH 2/4] Apply prepare changes --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 5c24d6ce..597e5178 100644 --- a/requirements.txt +++ b/requirements.txt @@ -84,4 +84,3 @@ werkzeug==3.1.8 # flask # flask-cors -opengeodeweb-microservice==1.*,>=1.4.0 From e6c8f5afcdd8542c25e89b803110ace7b8a8c1f3 Mon Sep 17 00:00:00 2001 From: MaxNumerique <144453705+MaxNumerique@users.noreply.github.com> Date: Thu, 26 Nov 2026 13:52:48 +0000 Subject: [PATCH 3/4] Apply prepare changes --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index aefa233f..597e5178 100644 --- a/requirements.txt +++ b/requirements.txt @@ -84,4 +84,3 @@ werkzeug==3.1.8 # flask # flask-cors -opengeodeweb-microservice==1.*,>=1.5.0rc1 From f84812aea8f3f0fccba418dfaa01e74da5e51388 Mon Sep 17 00:00:00 2001 From: MaxNumerique Date: Thu, 26 Nov 2026 15:14:31 +0100 Subject: [PATCH 4/4] fix(tests): no concurrent database writes in the parallel native saves test The two imports of test_concurrent_imports_save_in_parallel wrote the SQLite database from two threads at once, which corrupted it on Windows CI ("unsupported file format", then "database disk image is malformed" for every next test). Each import answers while its native save is blocked: issued one after the other, both saves are still pending at once. Co-Authored-By: Claude Opus 5.5 --- tests/test_background_native_save.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/test_background_native_save.py b/tests/test_background_native_save.py index d50b9159..7381feb6 100644 --- a/tests/test_background_native_save.py +++ b/tests/test_background_native_save.py @@ -228,11 +228,12 @@ def test_failed_native_save_aborts_load( def test_concurrent_imports_save_in_parallel(client: FlaskClient, native_save: NativeSave) -> None: - """(e) Two imports issued concurrently run their native saves in parallel.""" - first = _import(client, native_save) - second = _import(client, native_save) - for import_call in (first, second): - assert import_call.result().status_code == 200 + """(e) Two imports run their native saves in parallel.""" + # One import after the other: each answers while its native save is blocked, so both saves + # are pending at once. Concurrent requests would write the SQLite database from two threads + # at once, which corrupts it on Windows CI + for _ in range(2): + assert _import(client, native_save).result().status_code == 200 assert native_save.wait_entered(2), "both native saves should run at once" native_save.release.set() with client.application.app_context():