FEM: unit test, extend the make objects test

This commit is contained in:
Bernd Hahnebach
2017-11-08 18:17:32 +01:00
committed by wmayer
parent 551f6dc4ae
commit bb764b1475

View File

@@ -382,11 +382,7 @@ class FemTest(unittest.TestCase):
analysis.addObject(ObjectsFem.makeSolverZ88(doc))
doc.recompute()
self.assertEqual(len(analysis.Group), 30)
'''
grep -c "def make" src/Mod/Fem/ObjectsFem.py
because of the analysis itself count -1
'''
self.assertEqual(len(analysis.Group), get_defmake_count() - 1) # because of the analysis itself count -1
def test_pyimport_all_FEM_modules(self):
# we're gonna try to import all python modules from FreeCAD Fem
@@ -983,6 +979,20 @@ def fcc_print(message):
FreeCAD.Console.PrintMessage('{} \n'.format(message))
def get_defmake_count():
'''
count the def make in module ObjectsFem
could also be donn in bash with
grep -c "def make" src/Mod/Fem/ObjectsFem.py
'''
name_modfile = home_path + 'Mod/Fem/ObjectsFem.py'
modfile = open(name_modfile, 'r')
lines_modefile = modfile.readlines()
modfile.close()
lines_defmake = [l for l in lines_modefile if l.startswith('def make')]
return len(lines_defmake)
def compare_inp_files(file_name1, file_name2):
file1 = open(file_name1, 'r')
f1 = file1.readlines()