From f901477601a255049ca65372f19b57a4037e614a Mon Sep 17 00:00:00 2001 From: Furgo <148809153+furgo16@users.noreply.github.com> Date: Sun, 11 May 2025 00:04:41 +0200 Subject: [PATCH] BIM: add workaround for Draft workbench test mockup --- src/Mod/BIM/bimtests/TestArchBase.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Mod/BIM/bimtests/TestArchBase.py b/src/Mod/BIM/bimtests/TestArchBase.py index 00cbcac583..d055380b03 100644 --- a/src/Mod/BIM/bimtests/TestArchBase.py +++ b/src/Mod/BIM/bimtests/TestArchBase.py @@ -30,6 +30,21 @@ import FreeCAD class TestArchBase(unittest.TestCase): def setUp(self): + import Draft + from importlib import reload + + # Restore original Draft.extrude function if mocked + # This is a workaround for the issue where the Draft.extrude function + # is replaced with a mock function (drafttests.auxiliary.fake_function) + # during testing. + # See https://github.com/FreeCAD/FreeCAD/pull/21134#issuecomment-2868570722 + if hasattr(Draft, 'extrude'): + extrude_code = getattr(Draft.extrude, '__code__', None) + if extrude_code and 'auxiliary.py' in extrude_code.co_filename: + reload(Draft) + from Draft import extrude + Draft.extrude = extrude + self.document = FreeCAD.newDocument(self.__class__.__name__) def tearDown(self):