Skip to content

Commit df4be43

Browse files
committed
update test data structure and paths
- Replace legacy single ID structure with multiple test IDs and new UUID-based structure - Add support for project/data UUID paths and uploads directory - Update texture path in VtkObjectView to include ID parameter
1 parent d376f8b commit df4be43

File tree

2 files changed

+26
-28
lines changed

2 files changed

+26
-28
lines changed

src/opengeodeweb_viewer/config.py

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import os
2-
from glob import glob
32
import tempfile
43
from shutil import copyfile, copytree
54
from sys import platform
@@ -38,44 +37,43 @@ def test_config(path):
3837
raise FileNotFoundError(f"Test data folder not found: {original_data_path}")
3938

4039
valid_extensions = {".vtp", ".vti", ".vtu", ".vtm", ".png", ".jpeg", ".jpg"}
41-
42-
legacy_id = "123456789"
43-
legacy_dir = os.path.join(tmp_data_root, legacy_id)
44-
os.makedirs(legacy_dir, exist_ok=True)
40+
41+
test_ids = ["123456789", "12345678"]
42+
43+
for test_id in test_ids:
44+
test_id_dir = os.path.join(tmp_data_root, test_id)
45+
os.makedirs(test_id_dir, exist_ok=True)
46+
47+
test_project_uuid = "test-project-uuid"
48+
test_data_uuid = "test-data-uuid"
49+
new_structure_dir = os.path.join(tmp_data_root, test_project_uuid, test_data_uuid)
50+
os.makedirs(new_structure_dir, exist_ok=True)
51+
52+
uploads_dir = os.path.join(tmp_data_root, test_project_uuid, "uploads")
53+
os.makedirs(uploads_dir, exist_ok=True)
4554

4655
for root, dirs, files in os.walk(original_data_path):
47-
rel_root = os.path.relpath(root, original_data_path)
48-
49-
# Copier sous-dossiers (comme cube/) dans leur ensemble
5056
for d in dirs:
5157
src_dir = os.path.join(root, d)
52-
dst_dir = os.path.join(tmp_data_root, legacy_id, d)
58+
dst_dir = os.path.join(tmp_data_root, test_ids[0], d)
5359
if not os.path.exists(dst_dir):
5460
copytree(src_dir, dst_dir, dirs_exist_ok=True)
55-
print(f"📦 Copied folder: {src_dir}{dst_dir}", flush=True)
5661

5762
for file_name in files:
5863
ext = os.path.splitext(file_name)[1].lower()
5964
if ext not in valid_extensions:
6065
continue
6166

6267
full_path = os.path.join(root, file_name)
63-
uuid = os.path.splitext(file_name)[0]
64-
65-
# uuid/filename
66-
dst_dir = os.path.join(tmp_data_root, uuid)
67-
os.makedirs(dst_dir, exist_ok=True)
68-
dst = os.path.join(dst_dir, file_name)
69-
copyfile(full_path, dst)
70-
71-
# legacy path: 123456789/filename
72-
legacy_dst = os.path.join(legacy_dir, file_name)
73-
copyfile(full_path, legacy_dst)
74-
75-
# root-level copy
76-
root_level_dst = os.path.join(tmp_data_root, file_name)
77-
copyfile(full_path, root_level_dst)
78-
79-
print(f"📄 Copied file: {full_path}{root_level_dst}", flush=True)
68+
69+
for test_id in test_ids:
70+
test_id_dst = os.path.join(tmp_data_root, test_id, file_name)
71+
copyfile(full_path, test_id_dst)
72+
73+
new_structure_dst = os.path.join(new_structure_dir, file_name)
74+
copyfile(full_path, new_structure_dst)
75+
76+
uploads_dst = os.path.join(uploads_dir, file_name)
77+
copyfile(full_path, uploads_dst)
8078

8179
print(f"\n✅ DATA_FOLDER_PATH set to: {tmp_data_root}", flush=True)

src/opengeodeweb_viewer/object/object_methods.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def applyTextures(self, id, textures):
5858
new_texture = vtk.vtkTexture()
5959
image_reader = vtk.vtkXMLImageDataReader()
6060
image_reader.SetFileName(
61-
os.path.join(self.DATA_FOLDER_PATH, texture_file_name)
61+
os.path.join(self.DATA_FOLDER_PATH, id, texture_file_name)
6262
)
6363

6464
shader_texture_name = f"VTK_TEXTURE_UNIT_{index}"

0 commit comments

Comments
 (0)