3030
3131
3232@pytest .fixture (scope = "module" )
33- def load_all_types_plugin ():
34- current_dir = os .getcwd ()
33+ def load_all_types_plugin (testfiles_dir ):
3534 return dpf .load_library (
3635 dpf .path_utilities .to_server_os (
37- os .path .join (current_dir , "testfiles" , "pythonPlugins" , "all_types" )
36+ os .path .join (testfiles_dir , "pythonPlugins" , "all_types" )
3837 ),
3938 "py_test_types" ,
4039 "load_operators" ,
4140 )
4241
4342
44- def load_all_types_plugin_with_serv (my_server ):
45- current_dir = os .getcwd ()
43+ def load_all_types_plugin_with_serv (my_server , testfiles_dir ):
4644 return dpf .load_library (
4745 dpf .path_utilities .to_server_os (
48- os .path .join (current_dir , "testfiles" , "pythonPlugins" , "all_types" ), my_server
46+ os .path .join (testfiles_dir , "pythonPlugins" , "all_types" ), my_server
4947 ),
5048 "py_test_types" ,
5149 "load_operators" ,
5250 server = my_server ,
5351 )
5452
5553
56- def test_integral_types (server_type_remote_process ):
57- load_all_types_plugin_with_serv (server_type_remote_process )
54+ def test_integral_types (server_type_remote_process , testfiles_dir ):
55+ load_all_types_plugin_with_serv (server_type_remote_process , testfiles_dir )
5856 op = dpf .Operator ("custom_forward_int" , server = server_type_remote_process )
5957 op .connect (0 , 1 )
6058 assert op .get_output (0 , dpf .types .int ) == 1
@@ -74,8 +72,8 @@ def test_integral_types(server_type_remote_process):
7472 assert op .get_output (0 , dpf .types .string ) == "hello"
7573
7674
77- def test_lists (server_type_remote_process ):
78- load_all_types_plugin_with_serv (server_type_remote_process )
75+ def test_lists (server_type_remote_process , testfiles_dir ):
76+ load_all_types_plugin_with_serv (server_type_remote_process , testfiles_dir )
7977 op = dpf .Operator (
8078 "custom_forward_vec_int" , server = server_type_remote_process
8179 )
@@ -97,8 +95,8 @@ def test_lists(server_type_remote_process):
9795 assert np .allclose (op .get_output (0 , dpf .types .vec_double ), np .ones ((200 )))
9896
9997
100- def test_field (server_type_remote_process ):
101- load_all_types_plugin_with_serv (server_type_remote_process )
98+ def test_field (server_type_remote_process , testfiles_dir ):
99+ load_all_types_plugin_with_serv (server_type_remote_process , testfiles_dir )
102100 f = dpf .fields_factory .create_3d_vector_field (
103101 3 , "Elemental" , server = server_type_remote_process
104102 )
@@ -113,8 +111,8 @@ def test_field(server_type_remote_process):
113111 assert op .get_output (0 , dpf .types .field ).location == "Elemental"
114112
115113
116- def test_property_field (server_type_remote_process ):
117- load_all_types_plugin_with_serv (server_type_remote_process )
114+ def test_property_field (server_type_remote_process , testfiles_dir ):
115+ load_all_types_plugin_with_serv (server_type_remote_process , testfiles_dir )
118116 f = dpf .PropertyField (server = server_type_remote_process )
119117 f .data = np .ones ((9 ), dtype = np .int32 )
120118 op = dpf .Operator (
@@ -128,8 +126,8 @@ def test_property_field(server_type_remote_process):
128126
129127
130128@conftest .raises_for_servers_version_under ("5.0" )
131- def test_string_field (server_type_remote_process ):
132- load_all_types_plugin_with_serv (server_type_remote_process )
129+ def test_string_field (server_type_remote_process , testfiles_dir ):
130+ load_all_types_plugin_with_serv (server_type_remote_process , testfiles_dir )
133131 f = dpf .StringField (server = server_type_remote_process )
134132 f .data = ["hello" , "good" ]
135133 op = dpf .Operator ("custom_forward_string_field" , server = server_type_remote_process )
@@ -138,8 +136,8 @@ def test_string_field(server_type_remote_process):
138136
139137
140138@conftest .raises_for_servers_version_under ("5.0" )
141- def test_custom_type_field (server_type_remote_process ):
142- load_all_types_plugin_with_serv (server_type_remote_process )
139+ def test_custom_type_field (server_type_remote_process , testfiles_dir ):
140+ load_all_types_plugin_with_serv (server_type_remote_process , testfiles_dir )
143141 f = dpf .CustomTypeField (np .uint64 , server = server_type_remote_process )
144142 f .data = np .array ([1000000000000 , 200000000000000 ], dtype = np .uint64 )
145143 op = dpf .Operator ("custom_forward_custom_type_field" , server = server_type_remote_process )
@@ -150,16 +148,16 @@ def test_custom_type_field(server_type_remote_process):
150148 )
151149
152150
153- def test_scoping (server_type_remote_process ):
154- load_all_types_plugin_with_serv (server_type_remote_process )
151+ def test_scoping (server_type_remote_process , testfiles_dir ):
152+ load_all_types_plugin_with_serv (server_type_remote_process , testfiles_dir )
155153 f = dpf .Scoping (location = "Elemental" , server = server_type_remote_process )
156154 op = dpf .Operator ("custom_forward_scoping" , server = server_type_remote_process )
157155 op .connect (0 , f )
158156 assert op .get_output (0 , dpf .types .scoping ).location == "Elemental"
159157
160158
161- def test_fields_container (server_type_remote_process ):
162- load_all_types_plugin_with_serv (server_type_remote_process )
159+ def test_fields_container (server_type_remote_process , testfiles_dir ):
160+ load_all_types_plugin_with_serv (server_type_remote_process , testfiles_dir )
163161 f = dpf .fields_factory .create_3d_vector_field (
164162 3 , "Elemental" , server = server_type_remote_process
165163 )
@@ -180,8 +178,8 @@ def test_fields_container(server_type_remote_process):
180178 )
181179
182180
183- def test_scopings_container (server_type_remote_process ):
184- load_all_types_plugin_with_serv (server_type_remote_process )
181+ def test_scopings_container (server_type_remote_process , testfiles_dir ):
182+ load_all_types_plugin_with_serv (server_type_remote_process , testfiles_dir )
185183 f = dpf .Scoping (location = "Elemental" , server = server_type_remote_process )
186184 sc = dpf .ScopingsContainer (server = server_type_remote_process )
187185 sc .add_scoping ({}, f )
@@ -195,8 +193,8 @@ def test_scopings_container(server_type_remote_process):
195193 )
196194
197195
198- def test_meshes_container (server_type_remote_process ):
199- load_all_types_plugin_with_serv (server_type_remote_process )
196+ def test_meshes_container (server_type_remote_process , testfiles_dir ):
197+ load_all_types_plugin_with_serv (server_type_remote_process , testfiles_dir )
200198 f = dpf .MeshedRegion (server = server_type_remote_process )
201199 sc = dpf .MeshesContainer (server = server_type_remote_process )
202200 sc .add_mesh ({}, f )
@@ -207,8 +205,8 @@ def test_meshes_container(server_type_remote_process):
207205 assert len (op .get_output (0 , dpf .types .meshes_container )) == 1
208206
209207
210- def test_data_sources (server_type_remote_process ):
211- load_all_types_plugin_with_serv (server_type_remote_process )
208+ def test_data_sources (server_type_remote_process , testfiles_dir ):
209+ load_all_types_plugin_with_serv (server_type_remote_process , testfiles_dir )
212210 f = dpf .DataSources ("file.rst" , server = server_type_remote_process )
213211 op = dpf .Operator (
214212 "custom_forward_data_sources" , server = server_type_remote_process
@@ -221,8 +219,8 @@ def test_data_sources(server_type_remote_process):
221219
222220@pytest .mark .skipif (platform .system () == "Windows" and platform .python_version ().startswith ("3.8" ),
223221 reason = "Random SEGFAULT in the GitHub pipeline for 3.8 on Windows" )
224- def test_workflow (server_type_remote_process ):
225- load_all_types_plugin_with_serv (server_type_remote_process )
222+ def test_workflow (server_type_remote_process , testfiles_dir ):
223+ load_all_types_plugin_with_serv (server_type_remote_process , testfiles_dir )
226224 f = dpf .Workflow (server = server_type_remote_process )
227225 op = dpf .Operator (
228226 "custom_forward_workflow" , server = server_type_remote_process
@@ -231,8 +229,8 @@ def test_workflow(server_type_remote_process):
231229 assert op .get_output (0 , dpf .types .workflow ) is not None
232230
233231
234- def test_data_tree (server_type_remote_process ):
235- load_all_types_plugin_with_serv (server_type_remote_process )
232+ def test_data_tree (server_type_remote_process , testfiles_dir ):
233+ load_all_types_plugin_with_serv (server_type_remote_process , testfiles_dir )
236234 f = dpf .DataTree (server = server_type_remote_process )
237235 f .add (name = "Paul" )
238236 op = dpf .Operator (
@@ -245,11 +243,10 @@ def test_data_tree(server_type_remote_process):
245243
246244
247245@conftest .raises_for_servers_version_under ("4.0" )
248- def test_syntax_error (server_type_remote_process ):
249- current_dir = os .getcwd ()
246+ def test_syntax_error (server_type_remote_process , testfiles_dir ):
250247 dpf .load_library (dpf .path_utilities .to_server_os (
251248 os .path .join (
252- current_dir , "testfiles" , "pythonPlugins" , "syntax_error_plugin"
249+ testfiles_dir , "pythonPlugins" , "syntax_error_plugin"
253250 ), server_type_remote_process ),
254251 "py_raising" ,
255252 "load_operators" ,
@@ -343,10 +340,9 @@ def test_create_properties_specification(server_in_process):
343340
344341
345342@conftest .raises_for_servers_version_under ("4.0" )
346- def test_custom_op_with_spec (server_type_remote_process ):
347- current_dir = os .getcwd ()
343+ def test_custom_op_with_spec (server_type_remote_process , testfiles_dir ):
348344 dpf .load_library (dpf .path_utilities .to_server_os (
349- os .path .join (current_dir , "testfiles" , "pythonPlugins" ), server_type_remote_process ),
345+ os .path .join (testfiles_dir , "pythonPlugins" ), server_type_remote_process ),
350346 "py_operator_with_spec" ,
351347 "load_operators" ,
352348 server = server_type_remote_process ,
0 commit comments