FEM: test package, move unit test module in new test package

This commit is contained in:
Bernd Hahnebach
2017-12-06 23:46:53 +01:00
parent bd3d50fa88
commit 8cdc4d3296
37 changed files with 83 additions and 69 deletions

View File

@@ -250,38 +250,43 @@ SET(FemGuiScripts_SRCS
)
SET(FemTests_SRCS
test_files/__init__.py
test_files/ccx/__init__.py
test_files/ccx/cube_mesh.py
test_files/ccx/cube_frequency.inp
test_files/ccx/cube_frequency.dat
test_files/ccx/cube_frequency.frd
test_files/ccx/cube_frequency_expected_values
test_files/ccx/cube_static.inp
test_files/ccx/cube_static.dat
test_files/ccx/cube_static.frd
test_files/ccx/cube_static_expected_values
test_files/ccx/cube.fcstd
test_files/ccx/spine_mesh.py
test_files/ccx/spine_thermomech.inp
test_files/ccx/spine_thermomech.dat
test_files/ccx/spine_thermomech.frd
test_files/ccx/spine_thermomech_expected_values
test_files/ccx/spine_thermomech.fcstd
test_files/ccx/Flow1D_mesh.py
test_files/ccx/Flow1D_thermomech.inp
test_files/ccx/Flow1D_thermomech.dat
test_files/ccx/Flow1D_thermomech.frd
test_files/ccx/Flow1D_thermomech_expected_values
test_files/ccx/Flow1D_thermomech_inout_nodes.txt
test_files/ccx/Flow1D_thermomech.fcstd
femtest/__init__.py
femtest/testfemcommon.py
)
SET(FemTestsCCx_SRCS
femtest/testfiles/__init__.py
femtest/testfiles/ccx/__init__.py
femtest/testfiles/ccx/cube_mesh.py
femtest/testfiles/ccx/cube_frequency.inp
femtest/testfiles/ccx/cube_frequency.dat
femtest/testfiles/ccx/cube_frequency.frd
femtest/testfiles/ccx/cube_frequency_expected_values
femtest/testfiles/ccx/cube_static.inp
femtest/testfiles/ccx/cube_static.dat
femtest/testfiles/ccx/cube_static.frd
femtest/testfiles/ccx/cube_static_expected_values
femtest/testfiles/ccx/cube.fcstd
femtest/testfiles/ccx/spine_mesh.py
femtest/testfiles/ccx/spine_thermomech.inp
femtest/testfiles/ccx/spine_thermomech.dat
femtest/testfiles/ccx/spine_thermomech.frd
femtest/testfiles/ccx/spine_thermomech_expected_values
femtest/testfiles/ccx/spine_thermomech.fcstd
femtest/testfiles/ccx/Flow1D_mesh.py
femtest/testfiles/ccx/Flow1D_thermomech.inp
femtest/testfiles/ccx/Flow1D_thermomech.dat
femtest/testfiles/ccx/Flow1D_thermomech.frd
femtest/testfiles/ccx/Flow1D_thermomech_expected_values
femtest/testfiles/ccx/Flow1D_thermomech_inout_nodes.txt
femtest/testfiles/ccx/Flow1D_thermomech.fcstd
)
SET(FemTestsElmer_SRCS
test_files/elmer/__init__.py
test_files/elmer/case.sif
test_files/elmer/group_mesh.geo
test_files/elmer/ELMERSOLVER_STARTINFO
femtest/testfiles/elmer/__init__.py
femtest/testfiles/elmer/case.sif
femtest/testfiles/elmer/group_mesh.geo
femtest/testfiles/elmer/ELMERSOLVER_STARTINFO
)
SET(FemBase_SRCS
@@ -396,6 +401,7 @@ fc_target_copy_resource(Fem
${FemMesh_SRCS}
${FemGuiScripts_SRCS}
${FemTests_SRCS}
${FemTestsCCx_SRCS}
${FemTestsElmer_SRCS}
${FemSolver_SRCS}
${FemElmer_SRCS}

View File

@@ -227,50 +227,55 @@ INSTALL(
INSTALL(
FILES
# changes on the file list here needs to be made in App/CMakeLists.txt as well
test_files/__init__.py
femtest/__init__.py
femtest/testfemcommon.py
DESTINATION
Mod/Fem/test_files
Mod/Fem/femtest
)
INSTALL(
FILES
# changes on the file list here needs to be made in App/CMakeLists.txt as well
test_files/ccx/__init__.py
test_files/ccx/cube_mesh.py
test_files/ccx/cube_frequency.inp
test_files/ccx/cube_frequency.dat
test_files/ccx/cube_frequency.frd
test_files/ccx/cube_frequency_expected_values
test_files/ccx/cube_static.inp
test_files/ccx/cube_static.dat
test_files/ccx/cube_static.frd
test_files/ccx/cube_static_expected_values
test_files/ccx/cube.fcstd
test_files/ccx/spine_mesh.py
test_files/ccx/spine_thermomech.inp
test_files/ccx/spine_thermomech.dat
test_files/ccx/spine_thermomech.frd
test_files/ccx/spine_thermomech_expected_values
test_files/ccx/spine_thermomech.fcstd
test_files/ccx/Flow1D_mesh.py
test_files/ccx/Flow1D_thermomech.inp
test_files/ccx/Flow1D_thermomech.dat
test_files/ccx/Flow1D_thermomech.frd
test_files/ccx/Flow1D_thermomech_expected_values
test_files/ccx/Flow1D_thermomech_inout_nodes.txt
test_files/ccx/Flow1D_thermomech.fcstd
femtest/testfiles/__init__.py
DESTINATION
Mod/Fem/test_files/ccx
Mod/Fem/femtest/testfiles
)
INSTALL(
FILES
# changes on the file list here needs to be made in App/CMakeLists.txt as well
test_files/elmer/__init__.py
test_files/elmer/case.sif
test_files/elmer/group_mesh.geo
test_files/elmer/ELMERSOLVER_STARTINFO
femtest/testfiles/ccx/__init__.py
femtest/testfiles/ccx/cube_mesh.py
femtest/testfiles/ccx/cube_frequency.inp
femtest/testfiles/ccx/cube_frequency.dat
femtest/testfiles/ccx/cube_frequency.frd
femtest/testfiles/ccx/cube_frequency_expected_values
femtest/testfiles/ccx/cube_static.inp
femtest/testfiles/ccx/cube_static.dat
femtest/testfiles/ccx/cube_static.frd
femtest/testfiles/ccx/cube_static_expected_values
femtest/testfiles/ccx/cube.fcstd
femtest/testfiles/ccx/spine_mesh.py
femtest/testfiles/ccx/spine_thermomech.inp
femtest/testfiles/ccx/spine_thermomech.dat
femtest/testfiles/ccx/spine_thermomech.frd
femtest/testfiles/ccx/spine_thermomech_expected_values
femtest/testfiles/ccx/spine_thermomech.fcstd
femtest/testfiles/ccx/Flow1D_mesh.py
femtest/testfiles/ccx/Flow1D_thermomech.inp
femtest/testfiles/ccx/Flow1D_thermomech.dat
femtest/testfiles/ccx/Flow1D_thermomech.frd
femtest/testfiles/ccx/Flow1D_thermomech_expected_values
femtest/testfiles/ccx/Flow1D_thermomech_inout_nodes.txt
femtest/testfiles/ccx/Flow1D_thermomech.fcstd
DESTINATION
Mod/Fem/test_files/elmer
Mod/Fem/femtest/testfiles/ccx
)
INSTALL(
FILES
femtest/testfiles/elmer/__init__.py
femtest/testfiles/elmer/case.sif
femtest/testfiles/elmer/group_mesh.geo
femtest/testfiles/elmer/ELMERSOLVER_STARTINFO
DESTINATION
Mod/Fem/femtest/testfiles/elmer
)

View File

@@ -41,8 +41,8 @@ home_path = FreeCAD.getHomePath()
temp_dir = tempfile.gettempdir() + '/FEM_unittests/'
if not os.path.exists(temp_dir):
os.makedirs(temp_dir)
test_file_dir = home_path + 'Mod/Fem/test_files/ccx/'
test_file_dir_elmer = home_path + 'Mod/Fem/test_files/elmer/'
test_file_dir = home_path + 'Mod/Fem/femtest/testfiles/ccx/'
test_file_dir_elmer = home_path + 'Mod/Fem/femtest/testfiles/elmer/'
# define some locations fot the analysis tests
# since they are also used in the helper def which create results they should stay global for the module
@@ -501,7 +501,8 @@ class FemCcxAnalysisTest(unittest.TestCase):
analysis.addObject(pressure_constraint)
fcc_print('Checking FEM new mesh...')
from test_files.ccx.cube_mesh import create_nodes_cube, create_elements_cube
from .testfiles.ccx.cube_mesh import create_nodes_cube
from .testfiles.ccx.cube_mesh import create_elements_cube
mesh = Fem.FemMesh()
ret = create_nodes_cube(mesh)
self.assertTrue(ret, "Import of mesh nodes failed")
@@ -750,7 +751,8 @@ class FemCcxAnalysisTest(unittest.TestCase):
analysis.addObject(heatflux_constraint)
fcc_print('Checking FEM new mesh...')
from test_files.ccx.spine_mesh import create_nodes_spine, create_elements_spine
from .testfiles.ccx.spine_mesh import create_nodes_spine
from .testfiles.ccx.spine_mesh import create_elements_spine
mesh = Fem.FemMesh()
ret = create_nodes_spine(mesh)
self.assertTrue(ret, "Import of mesh nodes failed")
@@ -997,7 +999,8 @@ class FemCcxAnalysisTest(unittest.TestCase):
analysis.addObject(Flow1d_self_weight)
fcc_print('Checking FEM new mesh...')
from test_files.ccx.Flow1D_mesh import create_nodes_Flow1D, create_elements_Flow1D
from .testfiles.ccx.Flow1D_mesh import create_nodes_Flow1D
from .testfiles.ccx.Flow1D_mesh import create_elements_Flow1D
mesh = Fem.FemMesh()
ret = create_nodes_Flow1D(mesh)
self.assertTrue(ret, "Import of mesh nodes failed")