Test: Allow WBs to know they are being run under test environment

This commit is contained in:
Yorik van Havre
2019-07-21 19:01:39 -03:00
parent 07a80bc24c
commit bd7dd045b3

View File

@@ -35,13 +35,18 @@ class WorkbenchTestCase(unittest.TestCase):
def testActivate(self):
wbs=FreeCADGui.listWorkbenches()
# this gives workbenches a possibility to detect that we're under test environment
FreeCAD.TestEnvironment = True
try:
for i in wbs:
success = FreeCADGui.activateWorkbench(i)
FreeCAD.Console.PrintLog("Active: "+FreeCADGui.activeWorkbench().name()+ " Expected: "+i+"\n")
self.assertTrue(success, "Test on activating workbench {0} failed".format(i))
except Exception as e:
del FreeCAD.TestEnvironment
self.fail("Loading of workbench '{0}' failed: {1}".format(i, e))
else:
del FreeCAD.TestEnvironment
def testHandler(self):
import __main__