this works ...
Code: Select all
import unittest
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.testcmdproblem.TestCmdProblem.test_face_subclass2"))
Code: Select all
>>>
>>>
>>> import unittest
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.testcmdproblem.TestCmdProblem.test_face_subclass2"))
>>> import TestCmdProblem
Shape: <Shape object at 0x562bd4eb9840>
isNull: True
Shape: <Solid object at 0x562bd4eb9840>
isNull: False
ShapeType: Solid
Subclass: True
(<Part::PartFeature>, ('Face1',))
ReferenceShape ... Type: Face, Object name: Box, Object label: Box, Element name: Face1
<Face object at 0x562bd4ebf140>
<class 'Part.Face'>
Face
.
----------------------------------------------------------------------
Ran 1 test in 0.009s
OK
<unittest.runner.TextTestResult run=1 errors=0 failures=0>
>>> >>>
>>>
restart FreeCAD Cmd, but this does not, the second one should be ok at least it has just above been ok:
Code: Select all
import unittest
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.testccxtools.TestCcxTools.test_1_static_analysis"))
# wait for output than
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.testcmdproblem.TestCmdProblem.test_face_subclass2"))
Code: Select all
>>>
>>>
>>> import unittest
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.testccxtools.TestCcxTools.test_1_static_analysis"))
>>> import TestCcxTools
--------------- Start of FEM tests ---------------
Checking FEM new analysis...
Checking FEM new solver...
Checking FEM new material...
Checking FEM new fixed constraint...
Checking FEM new force constraint...
Checking FEM new pressure constraint...
Checking FEM new mesh...
MechanicalMaterial has empty References.
FemConstraintFixed has Face reference shapes.
FemConstraintForce has Face reference shapes.
FemConstraintPressure has Face reference shapes.
Setting up working directory /tmp/FEM_unittests/FEM_ccx_static
Checking FEM inp file prerequisites for static analysis...
MechanicalMaterial has empty References.
Checking FEM inp file write...
Writing /tmp/FEM_unittests/FEM_ccx_static/Mesh.inp for static analysis
writerbaseCcx --> self.file_name --> /tmp/FEM_unittests/FEM_ccx_static/Mesh.inp
Constraint fixed: FemConstraintFixed
Finite element mesh nodes will be retrieved by searching the appropriate nodes in the finite element mesh.
(<Part::PartFeature>, ('Face1',))
ReferenceShape ... Type: Face, Object name: Box, Object label: Box, Element name: Face1
<Face object at 0x563252070d60>
<class 'Part.Face'>
Face
Unexpected error when writing CalculiX input file: <class 'TypeError'>
E
======================================================================
ERROR: test_1_static_analysis (femtest.testccxtools.TestCcxTools)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/hugo/Documents/dev/freecad/freecadbhb_dev/build/Mod/Fem/femtest/testccxtools.py", line 143, in test_1_static_analysis
error = fea.write_inp_file()
File "/home/hugo/Documents/dev/freecad/freecadbhb_dev/build/Mod/Fem/femtools/ccxtools.py", line 650, in write_inp_file
self.inp_file_name = inp_writer.write_calculix_input_file()
File "/home/hugo/Documents/dev/freecad/freecadbhb_dev/build/Mod/Fem/femsolver/calculix/writer.py", line 113, in write_calculix_input_file
self.write_calculix_one_input_file()
File "/home/hugo/Documents/dev/freecad/freecadbhb_dev/build/Mod/Fem/femsolver/calculix/writer.py", line 143, in write_calculix_one_input_file
self.write_node_sets_constraints_fixed(inpfile)
File "/home/hugo/Documents/dev/freecad/freecadbhb_dev/build/Mod/Fem/femsolver/calculix/writer.py", line 501, in write_node_sets_constraints_fixed
self.get_constraints_fixed_nodes()
File "/home/hugo/Documents/dev/freecad/freecadbhb_dev/build/Mod/Fem/femsolver/writerbase.py", line 133, in get_constraints_fixed_nodes
femobj
File "/home/hugo/Documents/dev/freecad/freecadbhb_dev/build/Mod/Fem/femmesh/meshtools.py", line 48, in get_femnodes_by_femobj_with_references
node_set = get_femnodes_by_references(femmesh, femobj['Object'].References)
File "/home/hugo/Documents/dev/freecad/freecadbhb_dev/build/Mod/Fem/femmesh/meshtools.py", line 84, in get_femnodes_by_references
references_femnodes += get_femnodes_by_refshape(femmesh, ref)
File "/home/hugo/Documents/dev/freecad/freecadbhb_dev/build/Mod/Fem/femmesh/meshtools.py", line 114, in get_femnodes_by_refshape
nodes += femmesh.getNodesByFace(r)
TypeError: argument 1 must be Part.TopoShape, not Part.Face
----------------------------------------------------------------------
Ran 1 test in 0.029s
FAILED (errors=1)
<unittest.runner.TextTestResult run=1 errors=1 failures=0>
>>>
>>>
>>>
>>>
>>> unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.testcmdproblem.TestCmdProblem.test_face_subclass2"))
import TestCmdProblem
Shape: <Shape object at 0x563251ff24e0>
isNull: True
Shape: <Solid object at 0x563251ff24e0>
isNull: False
ShapeType: Solid
Subclass: True
(<Part::PartFeature>, ('Face1',))
ReferenceShape ... Type: Face, Object name: Box, Object label: Box, Element name: Face1
<Face object at 0x563251ff4da0>
<class 'Part.Face'>
Face
E
======================================================================
ERROR: test_face_subclass2 (femtest.testcmdproblem.TestCmdProblem)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/hugo/Documents/dev/freecad/freecadbhb_dev/build/Mod/Fem/femtest/testcmdproblem.py", line 106, in test_face_subclass2
getnodes(femmesh, ref)
File "/home/hugo/Documents/dev/freecad/freecadbhb_dev/build/Mod/Fem/femmesh/meshtools.py", line 114, in get_femnodes_by_refshape
nodes += femmesh.getNodesByFace(r)
TypeError: argument 1 must be Part.TopoShape, not Part.Face
----------------------------------------------------------------------
Ran 1 test in 0.015s
FAILED (errors=1)
<unittest.runner.TextTestResult run=1 errors=1 failures=0>
>>>
>>>
very strange ...