33from src .opengeodeweb_back import geode_functions , geode_objects
44
55
6+ data_folder = os .path .join (os .path .dirname (__file__ ), "data" )
7+
8+
69def test_geode_object_value ():
710 for geode_object , value in geode_objects .geode_objects_dict ().items ():
811 geode_object_value = geode_functions .geode_object_value (geode_object )
@@ -39,7 +42,7 @@ def test_missing_files():
3942 for geode_object , value in geode_objects .geode_objects_dict ().items ():
4043 input_extensions = geode_functions .geode_object_input_extensions (geode_object )
4144 for input_extension in input_extensions :
42- file_absolute_path = os .path .abspath ( f"tests/data/ test.{ input_extension } " )
45+ file_absolute_path = os .path .join ( data_folder , f" test.{ input_extension } " )
4346 missing_files = geode_functions .missing_files (
4447 geode_object , file_absolute_path
4548 )
@@ -55,7 +58,7 @@ def test_is_loadable():
5558 for geode_object , value in geode_objects .geode_objects_dict ().items ():
5659 input_extensions = geode_functions .geode_object_input_extensions (geode_object )
5760 for input_extension in input_extensions :
58- file_absolute_path = os .path .abspath ( f"tests/data/ test.{ input_extension } " )
61+ file_absolute_path = os .path .join ( data_folder , f" test.{ input_extension } " )
5962 is_loadable = geode_functions .is_loadable (geode_object , file_absolute_path )
6063 assert type (is_loadable ) is bool
6164
@@ -66,18 +69,18 @@ def test_load():
6669 input_extensions = geode_functions .geode_object_input_extensions (geode_object )
6770 for input_extension in input_extensions :
6871 print (f"\t { input_extension = } " )
72+ file_absolute_path = os .path .join (data_folder , f"test.{ input_extension } " )
6973 missing_files = geode_functions .missing_files (
70- geode_object , f"tests/data/test. { input_extension } "
74+ geode_object , file_absolute_path
7175 )
7276 has_missing_files = missing_files .has_missing_files ()
7377 if has_missing_files :
7478 mandatory_files = missing_files .mandatory_files
7579 print (f"\t \t { mandatory_files = } " )
7680 additional_files = missing_files .additional_files
7781 print (f"\t \t { additional_files = } " )
78- file_apsolute_path = os .path .abspath (f"tests/data/test.{ input_extension } " )
79- if geode_functions .is_loadable (geode_object , file_apsolute_path ):
80- data = geode_functions .load (geode_object , file_apsolute_path )
82+ if geode_functions .is_loadable (geode_object , file_absolute_path ):
83+ data = geode_functions .load (geode_object , file_absolute_path )
8184 if "save_viewable" in value :
8285 uu_id = str (uuid .uuid4 ()).replace ("-" , "" )
8386 viewable_file_path = geode_functions .save_viewable (
@@ -149,16 +152,17 @@ def test_geode_object_output_extensions():
149152 input_extensions = geode_functions .geode_object_input_extensions (geode_object )
150153 for input_extension in input_extensions :
151154 print (f"\t { input_extension = } " )
155+ file_absolute_path = os .path .join (data_folder , f"test.{ input_extension } " )
152156 missing_files = geode_functions .missing_files (
153- geode_object , f"tests/data/test. { input_extension } "
157+ geode_object , file_absolute_path
154158 )
155159 has_missing_files = missing_files .has_missing_files ()
156160 if has_missing_files :
157161 mandatory_files = missing_files .mandatory_files
158162 print (f"\t \t { mandatory_files = } " )
159163 additional_files = missing_files .additional_files
160164 print (f"\t \t { additional_files = } " )
161- file_absolute_path = os .path .abspath ( f"tests/data/ test.{ input_extension } " )
165+ file_absolute_path = os .path .join ( data_folder , f" test.{ input_extension } " )
162166 if geode_functions .is_loadable (geode_object , file_absolute_path ):
163167 data = geode_functions .load (geode_object , file_absolute_path )
164168 geode_objets_and_output_extensions = (
@@ -227,8 +231,8 @@ def test_list_geode_objects():
227231 input_extensions = geode_functions .list_input_extensions (key )
228232 for geode_object , value in geode_objects .geode_objects_dict ().items ():
229233 for input_extension in input_extensions :
230- file_absolute_path = os .path .abspath (
231- f"tests/data/ test.{ input_extension } "
234+ file_absolute_path = os .path .join (
235+ data_folder , f" test.{ input_extension } "
232236 )
233237 return_dict = geode_functions .list_geode_objects (
234238 file_absolute_path , key
@@ -254,7 +258,7 @@ def test_geode_objects_output_extensions():
254258 for geode_object , value in geode_objects .geode_objects_dict ().items ():
255259 input_extensions = geode_functions .geode_object_input_extensions (geode_object )
256260 for input_extension in input_extensions :
257- file_absolute_path = f"tests/data/ test.{ input_extension } "
261+ file_absolute_path = os . path . join ( data_folder , f" test.{ input_extension } ")
258262 if geode_functions .is_loadable (geode_object , file_absolute_path ):
259263 data = geode_functions .load (geode_object , file_absolute_path )
260264 geode_objects_and_output_extensions = (
0 commit comments