2121# SOFTWARE.
2222"""Test design import."""
2323
24+ from pathlib import Path
25+
2426import numpy as np
2527from pint import Quantity
2628import pytest
3335from ansys .geometry .core .misc import UNITS
3436from ansys .geometry .core .sketch import Sketch
3537
36- from .conftest import skip_if_linux
38+ from .conftest import FILES_DIR , IMPORT_FILES_DIR , skip_if_linux
3739
3840
3941def _checker_method (comp : Component , comp_ref : Component , precise_check : bool = True ) -> None :
@@ -135,7 +137,7 @@ def test_design_import_with_surfaces_issue834(modeler: Modeler):
135137 skip_if_linux (modeler , test_design_import_with_surfaces_issue834 .__name__ , "open_file" )
136138
137139 # Open the design
138- design = modeler .open_file ("./tests/integration/files/ DuplicateFacesDesignBefore.scdocx" )
140+ design = modeler .open_file (Path ( FILES_DIR , " DuplicateFacesDesignBefore.scdocx") )
139141
140142 # Check that there are two bodies
141143 assert len (design .bodies ) == 2
@@ -207,39 +209,39 @@ def test_open_file(modeler: Modeler, tmp_path_factory: pytest.TempPathFactory):
207209 # file = tmp_path_factory.mktemp("test_design_import") / "two_cars.igs"
208210 # design.download(file, DesignFileFormat.IGES)
209211 # design2 = modeler.open_file(file)
210- # design3 = modeler.open_file("./tests/integration/files/import/ twoCars.igs")
212+ # design3 = modeler.open_file(Path(IMPORT_FILES_DIR, " twoCars.igs")
211213 # _checker_method(design2, design3, False)
212214
213215 # STEP
214216 file = tmp_path_factory .mktemp ("test_design_import" ) / "two_cars.step"
215217 design .download (file , DesignFileFormat .STEP )
216218 design2 = modeler .open_file (file )
217- design3 = modeler .open_file ("./tests/integration/files/import/ twoCars.stp" )
219+ design3 = modeler .open_file (Path ( IMPORT_FILES_DIR , " twoCars.stp") )
218220 _checker_method (design2 , design3 , False )
219221
220222 # Catia
221- design2 = modeler .open_file ("./tests/integration/files/import/ catia_car/car.CATProduct" )
223+ design2 = modeler .open_file (Path ( IMPORT_FILES_DIR , " catia_car/car.CATProduct") )
222224 _checker_method (design , design2 , False )
223225
224226 # Rhino
225- design2 = modeler .open_file ("./tests/integration/files/import/ box.3dm" )
227+ design2 = modeler .open_file (Path ( IMPORT_FILES_DIR , " box.3dm") )
226228 assert len (design2 .components ) == 1
227229 assert len (design2 .components [0 ].bodies ) == 1
228230
229231 # Stride
230- design2 = modeler .open_file ("./tests/integration/files/import/ sample_box.project" )
232+ design2 = modeler .open_file (Path ( IMPORT_FILES_DIR , " sample_box.project") )
231233 assert len (design2 .bodies ) == 1
232234
233235 # SolidWorks
234- design2 = modeler .open_file ("./tests/integration/files/import/ partColor.SLDPRT" )
236+ design2 = modeler .open_file (Path ( IMPORT_FILES_DIR , " partColor.SLDPRT") )
235237 assert len (design2 .components [0 ].bodies ) == 1
236238
237239 # .par
238- design2 = modeler .open_file ("./tests/integration/files/import/ Tank_Bottom.par" )
240+ design2 = modeler .open_file (Path ( IMPORT_FILES_DIR , " Tank_Bottom.par") )
239241 assert len (design2 .bodies ) == 1
240242
241243 # .prt
242- design2 = modeler .open_file ("./tests/integration/files/import/ disk1.prt" )
244+ design2 = modeler .open_file (Path ( IMPORT_FILES_DIR , " disk1.prt") )
243245 assert len (design2 .bodies ) == 1
244246
245247
@@ -257,7 +259,7 @@ def test_design_insert(modeler: Modeler):
257259 comp .extrude_sketch ("Body_Cylinder" , sketch , 5 )
258260
259261 # Insert a different file
260- design .insert_file ("./tests/integration/files/ DuplicateFacesDesignBefore.scdocx" )
262+ design .insert_file (Path ( FILES_DIR , " DuplicateFacesDesignBefore.scdocx") )
261263
262264 # Check that there are two components
263265 assert len (design .components ) == 2
@@ -280,7 +282,7 @@ def test_design_insert_with_import(modeler: Modeler):
280282 comp .extrude_sketch ("Body_Cylinder" , sketch , 5 )
281283
282284 # Import and insert a different file
283- design .insert_file ("./tests/integration/files/import/ catia_car/Wheel1.CATPart" )
285+ design .insert_file (Path ( IMPORT_FILES_DIR , " catia_car/Wheel1.CATPart") )
284286
285287 # Check that there are two components
286288 assert len (design .components ) == 2
0 commit comments