FEM: Restructure python test modules/packages
There is a new split into app and gui tests. For this purpose two packages where created: femtest.app and femtest.gui. Tests that don't require the GUI up and running are inside the femtest.app package. Tests that do require the GUI are inside the femtest.gui package. Also underscores where added to the module names: testcommon to test_common.
This commit is contained in:
committed by
Bernd Hahnebach
parent
f5e67238ef
commit
f96c805dbb
@@ -1179,7 +1179,7 @@ void FemMesh::readAbaqus(const std::string &FileName)
|
||||
/*
|
||||
Python command to read Abaqus inp mesh file from test suite:
|
||||
from feminout.importInpMesh import read as read_inp
|
||||
femmesh = read_inp(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/testfiles/mesh/tetra10_mesh.inp')
|
||||
femmesh = read_inp(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/data/mesh/tetra10_mesh.inp')
|
||||
*/
|
||||
|
||||
PyObject* module = PyImport_ImportModule("feminout.importInpMesh");
|
||||
@@ -1215,7 +1215,7 @@ void FemMesh::readZ88(const std::string &FileName)
|
||||
/*
|
||||
Python command to read Z88 mesh file from test suite:
|
||||
from feminout.importZ88Mesh import read as read_z88
|
||||
femmesh = read_z88(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/testfiles/mesh/tetra10_mesh.z88')
|
||||
femmesh = read_z88(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/data/mesh/tetra10_mesh.z88')
|
||||
*/
|
||||
|
||||
PyObject* module = PyImport_ImportModule("feminout.importZ88Mesh");
|
||||
|
||||
@@ -130,66 +130,70 @@ SET(FemSolverZ88_SRCS
|
||||
|
||||
SET(FemTests_SRCS
|
||||
femtest/__init__.py
|
||||
femtest/testccxtools.py
|
||||
femtest/testcommon.py
|
||||
femtest/testfemimport.py
|
||||
femtest/testmaterial.py
|
||||
femtest/testmesh.py
|
||||
femtest/testobject.py
|
||||
femtest/testresult.py
|
||||
femtest/testsolverframework.py
|
||||
femtest/utilstest.py
|
||||
)
|
||||
|
||||
SET(FemTestsApp_SRCS
|
||||
femtest/app/__init__.py
|
||||
femtest/app/support_utils.py
|
||||
femtest/app/test_ccxtools.py
|
||||
femtest/app/test_common.py
|
||||
femtest/app/test_femimport.py
|
||||
femtest/app/test_material.py
|
||||
femtest/app/test_mesh.py
|
||||
femtest/app/test_object.py
|
||||
femtest/app/test_result.py
|
||||
femtest/app/test_solverframework.py
|
||||
)
|
||||
|
||||
SET(FemTestsFiles_SRCS
|
||||
femtest/testfiles/__init__.py
|
||||
femtest/data/__init__.py
|
||||
)
|
||||
|
||||
SET(FemTestsCcx_SRCS
|
||||
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_frequency.FCStd
|
||||
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_static.FCStd
|
||||
femtest/testfiles/ccx/cube.FCStd
|
||||
femtest/testfiles/ccx/multimat.inp
|
||||
femtest/testfiles/ccx/multimat_mesh.py
|
||||
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
|
||||
femtest/data/ccx/__init__.py
|
||||
femtest/data/ccx/cube_mesh.py
|
||||
femtest/data/ccx/cube_frequency.inp
|
||||
femtest/data/ccx/cube_frequency.dat
|
||||
femtest/data/ccx/cube_frequency.frd
|
||||
femtest/data/ccx/cube_frequency_expected_values
|
||||
femtest/data/ccx/cube_frequency.FCStd
|
||||
femtest/data/ccx/cube_static.inp
|
||||
femtest/data/ccx/cube_static.dat
|
||||
femtest/data/ccx/cube_static.frd
|
||||
femtest/data/ccx/cube_static_expected_values
|
||||
femtest/data/ccx/cube_static.FCStd
|
||||
femtest/data/ccx/cube.FCStd
|
||||
femtest/data/ccx/multimat.inp
|
||||
femtest/data/ccx/multimat_mesh.py
|
||||
femtest/data/ccx/spine_mesh.py
|
||||
femtest/data/ccx/spine_thermomech.inp
|
||||
femtest/data/ccx/spine_thermomech.dat
|
||||
femtest/data/ccx/spine_thermomech.frd
|
||||
femtest/data/ccx/spine_thermomech_expected_values
|
||||
femtest/data/ccx/spine_thermomech.FCStd
|
||||
femtest/data/ccx/Flow1D_mesh.py
|
||||
femtest/data/ccx/Flow1D_thermomech.inp
|
||||
femtest/data/ccx/Flow1D_thermomech.dat
|
||||
femtest/data/ccx/Flow1D_thermomech.frd
|
||||
femtest/data/ccx/Flow1D_thermomech_expected_values
|
||||
femtest/data/ccx/Flow1D_thermomech_inout_nodes.txt
|
||||
femtest/data/ccx/Flow1D_thermomech.FCStd
|
||||
)
|
||||
|
||||
SET(FemTestsElmer_SRCS
|
||||
femtest/testfiles/elmer/__init__.py
|
||||
femtest/testfiles/elmer/case.sif
|
||||
femtest/testfiles/elmer/group_mesh.geo
|
||||
femtest/testfiles/elmer/ELMERSOLVER_STARTINFO
|
||||
femtest/data/elmer/__init__.py
|
||||
femtest/data/elmer/case.sif
|
||||
femtest/data/elmer/group_mesh.geo
|
||||
femtest/data/elmer/ELMERSOLVER_STARTINFO
|
||||
)
|
||||
|
||||
SET(FemTestsMesh_SRCS
|
||||
femtest/testfiles/mesh/__init__.py
|
||||
femtest/testfiles/mesh/tetra10_mesh.inp
|
||||
femtest/testfiles/mesh/tetra10_mesh.unv
|
||||
femtest/testfiles/mesh/tetra10_mesh.vtk
|
||||
femtest/testfiles/mesh/tetra10_mesh.yml
|
||||
femtest/testfiles/mesh/tetra10_mesh.z88
|
||||
femtest/data/mesh/__init__.py
|
||||
femtest/data/mesh/tetra10_mesh.inp
|
||||
femtest/data/mesh/tetra10_mesh.unv
|
||||
femtest/data/mesh/tetra10_mesh.vtk
|
||||
femtest/data/mesh/tetra10_mesh.yml
|
||||
femtest/data/mesh/tetra10_mesh.z88
|
||||
)
|
||||
|
||||
SET(FemTools_SRCS
|
||||
@@ -237,6 +241,7 @@ SET(FemAllScripts
|
||||
${FemSolverFenics_SRCS}
|
||||
${FemSolverZ88_SRCS}
|
||||
${FemTests_SRCS}
|
||||
${FemTestsApp_SRCS}
|
||||
${FemTestsFiles_SRCS}
|
||||
${FemTestsCcx_SRCS}
|
||||
${FemTestsElmer_SRCS}
|
||||
@@ -268,10 +273,11 @@ INSTALL(FILES ${FemSolverElmerEquations_SRCS} DESTINATION Mod/Fem/femsolver/elme
|
||||
INSTALL(FILES ${FemSolverFenics_SRCS} DESTINATION Mod/Fem/femsolver/fenics)
|
||||
INSTALL(FILES ${FemSolverZ88_SRCS} DESTINATION Mod/Fem/femsolver/z88)
|
||||
INSTALL(FILES ${FemTests_SRCS} DESTINATION Mod/Fem/femtest)
|
||||
INSTALL(FILES ${FemTestsFiles_SRCS} DESTINATION Mod/Fem/femtest/testfiles)
|
||||
INSTALL(FILES ${FemTestsCcx_SRCS} DESTINATION Mod/Fem/femtest/testfiles/ccx)
|
||||
INSTALL(FILES ${FemTestsElmer_SRCS} DESTINATION Mod/Fem/femtest/testfiles/elmer)
|
||||
INSTALL(FILES ${FemTestsMesh_SRCS} DESTINATION Mod/Fem/femtest/testfiles/mesh)
|
||||
INSTALL(FILES ${FemTestsApp_SRCS} DESTINATION Mod/Fem/femtest/app)
|
||||
INSTALL(FILES ${FemTestsFiles_SRCS} DESTINATION Mod/Fem/femtest/data)
|
||||
INSTALL(FILES ${FemTestsCcx_SRCS} DESTINATION Mod/Fem/femtest/data/ccx)
|
||||
INSTALL(FILES ${FemTestsElmer_SRCS} DESTINATION Mod/Fem/femtest/data/elmer)
|
||||
INSTALL(FILES ${FemTestsMesh_SRCS} DESTINATION Mod/Fem/femtest/data/mesh)
|
||||
INSTALL(FILES ${FemTools_SRCS} DESTINATION Mod/Fem/femtools)
|
||||
INSTALL(FILES ${FemObjectsScripts_SRCS} DESTINATION Mod/Fem/femobjects)
|
||||
|
||||
|
||||
@@ -26,16 +26,16 @@
|
||||
|
||||
# Unit test for the FEM module
|
||||
# to get the right order import as is used
|
||||
from femtest.testfemimport import TestFemImport as FemTest01
|
||||
from femtest.testcommon import TestFemCommon as FemTest02
|
||||
from femtest.testobject import TestObjectCreate as FemTest03
|
||||
from femtest.testobject import TestObjectType as FemTest04
|
||||
from femtest.testmaterial import TestMaterialUnits as FemTest05
|
||||
from femtest.testmesh import TestMeshCommon as FemTest06
|
||||
from femtest.testmesh import TestMeshEleTetra10 as FemTest07
|
||||
from femtest.testresult import TestResult as FemTest08
|
||||
from femtest.testccxtools import TestCcxTools as FemTest09
|
||||
from femtest.testsolverframework import TestSolverFrameWork as FemTest10
|
||||
from femtest.app.test_femimport import TestFemImport as FemTest01
|
||||
from femtest.app.test_common import TestFemCommon as FemTest02
|
||||
from femtest.app.test_object import TestObjectCreate as FemTest03
|
||||
from femtest.app.test_object import TestObjectType as FemTest04
|
||||
from femtest.app.test_material import TestMaterialUnits as FemTest05
|
||||
from femtest.app.test_mesh import TestMeshCommon as FemTest06
|
||||
from femtest.app.test_mesh import TestMeshEleTetra10 as FemTest07
|
||||
from femtest.app.test_result import TestResult as FemTest08
|
||||
from femtest.app.test_ccxtools import TestCcxTools as FemTest09
|
||||
from femtest.app.test_solverframework import TestSolverFrameWork as FemTest10
|
||||
|
||||
# dummy usage to get flake8 and lgtm quiet
|
||||
False if FemTest01.__name__ else True
|
||||
@@ -258,13 +258,12 @@ unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.t
|
||||
# open files from FEM test suite source code
|
||||
# be careful on updating these files, they contain the original results!
|
||||
# TODO update files, because some of them have non-existing FEM object classes
|
||||
app_home = FreeCAD.ConfigGet("AppHomePath")
|
||||
doc = FreeCAD.open(app_home + "Mod/Fem/femtest/testfiles/ccx/cube.FCStd")
|
||||
doc = FreeCAD.open(app_home + "Mod/Fem/femtest/testfiles/ccx/cube_frequency.FCStd")
|
||||
doc = FreeCAD.open(app_home + "Mod/Fem/femtest/testfiles/ccx/cube_static.FCStd")
|
||||
doc = FreeCAD.open(app_home + "Mod/Fem/femtest/testfiles/ccx/Flow1D_thermomech.FCStd")
|
||||
doc = FreeCAD.open(app_home + "Mod/Fem/femtest/testfiles/ccx/multimat.FCStd")
|
||||
doc = FreeCAD.open(app_home + "Mod/Fem/femtest/testfiles/ccx/spine_thermomech.FCStd")
|
||||
doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/data/ccx/cube.FCStd')
|
||||
doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/data/ccx/cube_frequency.FCStd')
|
||||
doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/data/ccx/cube_static.FCStd')
|
||||
doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/data/ccx/Flow1D_thermomech.FCStd')
|
||||
doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/data/ccx/multimat.FCStd')
|
||||
doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/data/ccx/spine_thermomech.FCStd')
|
||||
|
||||
# open files generated from test suite
|
||||
import femtest.utilstest as ut
|
||||
|
||||
@@ -36,7 +36,7 @@ from os.path import join
|
||||
|
||||
def get_fem_test_home_dir(
|
||||
):
|
||||
return join(FreeCAD.getHomePath(), "Mod", "Fem", "femtest", "testfiles")
|
||||
return join(FreeCAD.getHomePath(), "Mod", "Fem", "femtest", "data")
|
||||
|
||||
|
||||
def get_fem_test_tmp_dir(
|
||||
@@ -28,8 +28,8 @@ from femtools import ccxtools
|
||||
import FreeCAD
|
||||
import ObjectsFem
|
||||
import unittest
|
||||
from . import utilstest as testtools
|
||||
from .utilstest import fcc_print
|
||||
from . import support_utils as testtools
|
||||
from .support_utils import fcc_print
|
||||
|
||||
from os.path import join
|
||||
|
||||
@@ -167,8 +167,8 @@ class TestCcxTools(unittest.TestCase):
|
||||
analysis.addObject(pressure_constraint)
|
||||
|
||||
fcc_print("Checking FEM new mesh...")
|
||||
from .testfiles.ccx.cube_mesh import create_nodes_cube
|
||||
from .testfiles.ccx.cube_mesh import create_elements_cube
|
||||
from ..data.ccx.cube_mesh import create_nodes_cube
|
||||
from ..data.ccx.cube_mesh import create_elements_cube
|
||||
mesh = Fem.FemMesh()
|
||||
ret = create_nodes_cube(mesh)
|
||||
self.assertTrue(
|
||||
@@ -380,7 +380,7 @@ class TestCcxTools(unittest.TestCase):
|
||||
analysis.addObject(pressure_constraint)
|
||||
|
||||
mesh = Fem.FemMesh()
|
||||
import femtest.testfiles.ccx.multimat_mesh as multimatmesh
|
||||
import femtest.data.ccx.multimat_mesh as multimatmesh
|
||||
multimatmesh.create_nodes(mesh)
|
||||
multimatmesh.create_elements(mesh)
|
||||
mesh_object = self.active_doc.addObject("Fem::FemMeshObject", self.mesh_name)
|
||||
@@ -481,8 +481,8 @@ class TestCcxTools(unittest.TestCase):
|
||||
analysis.addObject(material_object)
|
||||
|
||||
fcc_print("Checking FEM new mesh...")
|
||||
from .testfiles.ccx.cube_mesh import create_nodes_cube
|
||||
from .testfiles.ccx.cube_mesh import create_elements_cube
|
||||
from ..data.ccx.cube_mesh import create_nodes_cube
|
||||
from ..data.ccx.cube_mesh import create_elements_cube
|
||||
mesh = Fem.FemMesh()
|
||||
ret = create_nodes_cube(mesh)
|
||||
self.assertTrue(ret, "Import of mesh nodes failed")
|
||||
@@ -704,8 +704,8 @@ class TestCcxTools(unittest.TestCase):
|
||||
analysis.addObject(heatflux_constraint)
|
||||
|
||||
fcc_print("Checking FEM new mesh...")
|
||||
from .testfiles.ccx.spine_mesh import create_nodes_spine
|
||||
from .testfiles.ccx.spine_mesh import create_elements_spine
|
||||
from ..data.ccx.spine_mesh import create_nodes_spine
|
||||
from ..data.ccx.spine_mesh import create_elements_spine
|
||||
mesh = Fem.FemMesh()
|
||||
ret = create_nodes_spine(mesh)
|
||||
self.assertTrue(
|
||||
@@ -1106,8 +1106,8 @@ class TestCcxTools(unittest.TestCase):
|
||||
analysis.addObject(Flow1d_self_weight)
|
||||
|
||||
fcc_print("Checking FEM new mesh...")
|
||||
from .testfiles.ccx.Flow1D_mesh import create_nodes_Flow1D
|
||||
from .testfiles.ccx.Flow1D_mesh import create_elements_Flow1D
|
||||
from ..data.ccx.Flow1D_mesh import create_nodes_Flow1D
|
||||
from ..data.ccx.Flow1D_mesh import create_elements_Flow1D
|
||||
mesh = Fem.FemMesh()
|
||||
ret = create_nodes_Flow1D(mesh)
|
||||
self.assertTrue(ret, "Import of mesh nodes failed")
|
||||
@@ -26,8 +26,8 @@
|
||||
import FreeCAD
|
||||
import ObjectsFem
|
||||
import unittest
|
||||
from . import utilstest as testtools
|
||||
from .utilstest import fcc_print
|
||||
from . import support_utils as testtools
|
||||
from .support_utils import fcc_print
|
||||
|
||||
|
||||
class TestFemCommon(unittest.TestCase):
|
||||
@@ -26,7 +26,7 @@
|
||||
import unittest
|
||||
|
||||
import FreeCAD
|
||||
from femtest.utilstest import fcc_print
|
||||
from .support_utils import fcc_print
|
||||
|
||||
|
||||
class TestFemImport(unittest.TestCase):
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
import FreeCAD
|
||||
import unittest
|
||||
from .utilstest import fcc_print
|
||||
from .support_utils import fcc_print
|
||||
|
||||
from os.path import join
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
import Fem
|
||||
import FreeCAD
|
||||
import unittest
|
||||
from . import utilstest as testtools
|
||||
from .utilstest import fcc_print
|
||||
from . import support_utils as testtools
|
||||
from .support_utils import fcc_print
|
||||
|
||||
from os.path import join
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
import FreeCAD
|
||||
import ObjectsFem
|
||||
import unittest
|
||||
from . import utilstest as testtools
|
||||
from .utilstest import fcc_print
|
||||
from . import support_utils as testtools
|
||||
from .support_utils import fcc_print
|
||||
|
||||
|
||||
class TestObjectCreate(unittest.TestCase):
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
import FreeCAD
|
||||
import unittest
|
||||
from . import utilstest as testtools
|
||||
from .utilstest import fcc_print
|
||||
from . import support_utils as testtools
|
||||
from .support_utils import fcc_print
|
||||
|
||||
from os.path import join
|
||||
|
||||
@@ -27,8 +27,8 @@ import FreeCAD
|
||||
import ObjectsFem
|
||||
import femsolver.run
|
||||
import unittest
|
||||
from . import utilstest as testtools
|
||||
from .utilstest import fcc_print
|
||||
from . import support_utils as testtools
|
||||
from .support_utils import fcc_print
|
||||
|
||||
from os.path import join
|
||||
|
||||
@@ -127,8 +127,8 @@ class TestSolverFrameWork(unittest.TestCase):
|
||||
analysis.addObject(pressure_constraint)
|
||||
|
||||
fcc_print("Checking FEM new mesh...")
|
||||
from .testfiles.ccx.cube_mesh import create_nodes_cube
|
||||
from .testfiles.ccx.cube_mesh import create_elements_cube
|
||||
from ..data.ccx.cube_mesh import create_nodes_cube
|
||||
from ..data.ccx.cube_mesh import create_elements_cube
|
||||
mesh = Fem.FemMesh()
|
||||
ret = create_nodes_cube(mesh)
|
||||
self.assertTrue(ret, "Import of mesh nodes failed")
|
||||
0
src/Mod/Fem/femtest/data/mesh/__init__.py
Normal file
0
src/Mod/Fem/femtest/data/mesh/__init__.py
Normal file
Reference in New Issue
Block a user