From 00fea5057c000b1622cc81a00449de36ff1f1564 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 16 May 2022 13:33:32 +0200 Subject: [PATCH] Test: [skip ci] unit test for Commands related to PR #6889 --- src/Mod/Test/Workbench.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Mod/Test/Workbench.py b/src/Mod/Test/Workbench.py index d382421ea6..9b9d83a0b4 100755 --- a/src/Mod/Test/Workbench.py +++ b/src/Mod/Test/Workbench.py @@ -24,6 +24,7 @@ # Workbench test module import FreeCAD, FreeCADGui, os, unittest +import tempfile from PySide2 import QtWidgets, QtCore from PySide2.QtWidgets import QApplication @@ -79,3 +80,16 @@ class WorkbenchTestCase(unittest.TestCase): def tearDown(self): FreeCADGui.activateWorkbench(self.Active.name()) FreeCAD.Console.PrintLog(self.Active.name()) + +class CommandTestCase(unittest.TestCase): + def testPR6889(self): + # Fixes a crash + TempPath = tempfile.gettempdir() + macroName = TempPath + os.sep + "testmacro.py" + macroFile = open(macroName, "w") + macroFile.write("print ('Hello, World!')") + macroFile.close() + + name = FreeCADGui.Command.createCustomCommand(macroName) + cmd = FreeCADGui.Command.get(name) + cmd.run()