diff --git a/cadquery/freecad_impl/importers.py b/cadquery/freecad_impl/importers.py index fd47742..55d67fe 100644 --- a/cadquery/freecad_impl/importers.py +++ b/cadquery/freecad_impl/importers.py @@ -40,7 +40,7 @@ def importShape(importType,fileName): #Check to see what type of file we're working with if importType == ImportTypes.STEP: - raise RuntimeError("Failed on purpose.") + importStep(fileName) #Loads a STEP file into a CQ object def importStep(self,fileName): diff --git a/tests/TestImporters.py b/tests/TestImporters.py index 5af0f9b..6ede15f 100644 --- a/tests/TestImporters.py +++ b/tests/TestImporters.py @@ -18,28 +18,29 @@ else: class TestImporters(BaseTest): - def importBox(importType,fileName): + def importBox(self, importType,fileName): """ Exports a simple box to a STEP file and then imports it again :param importType: The type of file we're importing (STEP, STL, etc) :param fileName: The path and name of the file to write to """ #We're importing a STEP file - if importType == ImportTypes.STEP: + if importType == importers.ImportTypes.STEP: #We first need to build a simple shape to export - shape = Workplane("XY").box(1,2,3).val + shape = Workplane("XY").box(1,2,3).val() #Export the shape to a temporary file shape.exportStep(fileName) # Reimport the shape from the new STEP file - importedShape = importShape(importType,fileName) + importedShape = importers.importShape(importType,fileName) def testSTEP(self): """ Tests STEP file import """ - importBox(ImportTypes.STEP, OUTDIR + "/tempSTEP.step") + self.importBox(importers.ImportTypes.STEP, OUTDIR + "/tempSTEP.step") if __name__ == '__main__': - testSTEP() + import unittest + unittest.main()