FEM: unit tests, some defs to open the FreeCAD test files
This commit is contained in:
committed by
Yorik van Havre
parent
ce86fa4365
commit
cba29e6ce6
@@ -85,14 +85,6 @@ unittest.TextTestRunner().run(mytest)
|
||||
./bin/FreeCAD --run-test "femtest.testcommon.TestFemCommon.test_pyimport_all_FEM_modules"
|
||||
|
||||
|
||||
# open files generated from test suite
|
||||
from femtest.utilstest import get_fem_test_tmp_dir as test_file_dir
|
||||
doc = FreeCAD.open(test_file_dir() + 'FEM_ccx_Flow1D_thermomech/Flow1D_thermomech.FCStd')
|
||||
doc = FreeCAD.open(test_file_dir() + 'FEM_ccx_frequency/cube_frequency.FCStd')
|
||||
doc = FreeCAD.open(test_file_dir() + 'FEM_ccx_multimat/multimat.FCStd')
|
||||
doc = FreeCAD.open(test_file_dir() + 'FEM_ccx_static/cube_static.FCStd')
|
||||
doc = FreeCAD.open(test_file_dir() + 'FEM_ccx_thermomech/spine_thermomech.FCStd')
|
||||
|
||||
# open files from FEM test suite source code
|
||||
# be careful on updating these files, they consist the original results!
|
||||
# TODO update files, becaus some of them have non existing FEM object classes
|
||||
@@ -104,4 +96,22 @@ doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/testfiles
|
||||
doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/testfiles/ccx/spine_thermomech.FCStd')
|
||||
|
||||
|
||||
# open files generated from test suite
|
||||
import femtest.utilstest as ut
|
||||
ut.all_test_files()
|
||||
|
||||
doc = ut.cube_frequency()
|
||||
doc = ut.cube_static()
|
||||
doc = ut.Flow1D_thermomech()
|
||||
doc = ut.multimat()
|
||||
doc = spine_thermomech()
|
||||
|
||||
# load std FEM example files
|
||||
doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'data/examples/FemCalculixCantilever2D.FCStd')
|
||||
doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'data/examples/FemCalculixCantilever3D.FCStd')
|
||||
doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'data/examples/FemCalculixCantilever3D_newSolver.FCStd')
|
||||
doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'data/examples/Fem.FCStd')
|
||||
doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'data/examples/Fem2.FCStd')
|
||||
|
||||
'''
|
||||
|
||||
|
||||
@@ -27,9 +27,10 @@ __author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
|
||||
import FreeCAD
|
||||
import tempfile
|
||||
import os
|
||||
import unittest
|
||||
import tempfile
|
||||
import FreeCAD
|
||||
|
||||
|
||||
def get_fem_test_home_dir():
|
||||
@@ -175,3 +176,43 @@ def collect_python_modules(femsubdir=None):
|
||||
else:
|
||||
collected_modules.append(femsubdir.replace('/', '.') + '.' + os.path.splitext(os.path.basename(pyfile))[0])
|
||||
return collected_modules
|
||||
|
||||
|
||||
# open all files
|
||||
def all_test_files():
|
||||
cube_frequency()
|
||||
cube_static()
|
||||
Flow1D_thermomech()
|
||||
multimat()
|
||||
spine_thermomech()
|
||||
|
||||
|
||||
# run the specific test case of the file, open the file in FreeCAD GUI and return the doc identifier
|
||||
def cube_frequency():
|
||||
testname = "femtest.testccxtools.TestCcxTools.test_3_freq_analysis"
|
||||
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(testname))
|
||||
return FreeCAD.open(get_fem_test_tmp_dir() + 'FEM_ccx_frequency/cube_frequency.FCStd')
|
||||
|
||||
|
||||
def cube_static():
|
||||
testname = "femtest.testccxtools.TestCcxTools.test_1_static_analysis"
|
||||
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(testname))
|
||||
return FreeCAD.open(get_fem_test_tmp_dir() + 'FEM_ccx_static/cube_static.FCStd')
|
||||
|
||||
|
||||
def Flow1D_thermomech():
|
||||
testname = "femtest.testccxtools.TestCcxTools.test_5_Flow1D_thermomech_analysis"
|
||||
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(testname))
|
||||
return FreeCAD.open(get_fem_test_tmp_dir() + 'FEM_ccx_Flow1D_thermomech/Flow1D_thermomech.FCStd')
|
||||
|
||||
|
||||
def multimat():
|
||||
testname = "femtest.testccxtools.TestCcxTools.test_2_static_multiple_material"
|
||||
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(testname))
|
||||
return FreeCAD.open(get_fem_test_tmp_dir() + 'FEM_ccx_multimat/multimat.FCStd')
|
||||
|
||||
|
||||
def spine_thermomech():
|
||||
testname = "femtest.testccxtools.TestCcxTools.test_4_thermomech_analysis"
|
||||
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName(testname))
|
||||
return FreeCAD.open(get_fem_test_tmp_dir() + 'FEM_ccx_thermomech/spine_thermomech.FCStd')
|
||||
|
||||
Reference in New Issue
Block a user