From 8f8cca340a8eb75d742c2e34c4265dd5b3f56628 Mon Sep 17 00:00:00 2001 From: jfa Date: Fri, 24 Feb 2023 10:13:14 +0000 Subject: [PATCH] Remove temporary files after test execution --- src/ExchangePlugin/Test/TestExportPart_FullPartSet.py | 2 ++ src/ExchangePlugin/Test/TestExportPart_FullPart_2.py | 2 ++ src/ExchangePlugin/Test/TestExportPart_PartSet.py | 2 ++ src/ExchangePlugin/Test/TestExportPart_Results_1.py | 2 ++ src/ExchangePlugin/Test/TestExportPart_Results_2.py | 2 ++ src/ExchangePlugin/Test/TestExportPart_Results_3.py | 2 ++ src/ExchangePlugin/Test/TestExportPart_Results_7.py | 2 ++ src/ExchangePlugin/Test/TestExportPart_Results_8.py | 1 + src/ExchangePlugin/Test/TestImportPart_AfterCurrent_1.py | 2 ++ src/ExchangePlugin/Test/TestImportPart_AfterCurrent_2.py | 2 ++ src/ExchangePlugin/Test/TestImportPart_AfterLast_1.py | 2 ++ src/ExchangePlugin/Test/TestImportPart_AfterLast_2.py | 2 ++ src/ExchangePlugin/Test/TestImportPart_AfterLast_3.py | 2 ++ src/ExchangePlugin/Test/TestImportPart_AfterLast_4.py | 2 ++ src/ExchangePlugin/Test/TestImportPart_AfterLast_5.py | 2 ++ src/ExchangePlugin/Test/TestImportPart_AfterLast_6.py | 2 ++ src/ExchangePlugin/Test/TestImportPart_Construction_1.py | 2 ++ src/ExchangePlugin/Test/TestImportPart_Construction_2.py | 2 ++ src/ExchangePlugin/Test/TestImportPart_Construction_3.py | 2 ++ src/ExchangePlugin/Test/TestImportPart_Construction_4.py | 2 ++ src/ExchangePlugin/Test/TestImportPart_Multiple.py | 2 ++ src/ExchangePlugin/Test/TestImportPart_ToEmptyPart.py | 2 ++ src/ExchangePlugin/Test/TestImportPart_ToEmptyPartSet.py | 2 ++ src/PythonAPI/model/services/__init__.py | 1 + 24 files changed, 46 insertions(+) diff --git a/src/ExchangePlugin/Test/TestExportPart_FullPartSet.py b/src/ExchangePlugin/Test/TestExportPart_FullPartSet.py index 41c835beb..1eccc3f30 100644 --- a/src/ExchangePlugin/Test/TestExportPart_FullPartSet.py +++ b/src/ExchangePlugin/Test/TestExportPart_FullPartSet.py @@ -70,3 +70,5 @@ model.begin() model.exportPart(partSet, filename) model.end() assert os.path.exists(filename), "ERROR: Failed to export full PartSet" + +model.removeTmpFile(filename) diff --git a/src/ExchangePlugin/Test/TestExportPart_FullPart_2.py b/src/ExchangePlugin/Test/TestExportPart_FullPart_2.py index b9cfe6186..e6fc37025 100644 --- a/src/ExchangePlugin/Test/TestExportPart_FullPart_2.py +++ b/src/ExchangePlugin/Test/TestExportPart_FullPart_2.py @@ -70,3 +70,5 @@ model.begin() model.exportPart(Part_2_doc, filename) model.end() assert os.path.exists(filename), "ERROR: Cannot export Part_2 to file {}".format(filename) + +model.removeTmpFile(filename) diff --git a/src/ExchangePlugin/Test/TestExportPart_PartSet.py b/src/ExchangePlugin/Test/TestExportPart_PartSet.py index 9a8f57ac8..cd5c85631 100644 --- a/src/ExchangePlugin/Test/TestExportPart_PartSet.py +++ b/src/ExchangePlugin/Test/TestExportPart_PartSet.py @@ -70,3 +70,5 @@ model.begin() model.exportPart(partSet, filename, [Axis_4.result()]) model.end() assert os.path.exists(filename), "ERROR: Cannot export construction elements of PartSet" + +model.removeTmpFile(filename) diff --git a/src/ExchangePlugin/Test/TestExportPart_Results_1.py b/src/ExchangePlugin/Test/TestExportPart_Results_1.py index a8c40de4a..86b2aa564 100644 --- a/src/ExchangePlugin/Test/TestExportPart_Results_1.py +++ b/src/ExchangePlugin/Test/TestExportPart_Results_1.py @@ -72,3 +72,5 @@ model.begin() model.exportPart(partSet, filename, [featureToExport.result()]) model.end() assert os.path.exists(filename), "ERROR: Cannot export feature {}".format(featureToExport.name()) + +model.removeTmpFile(filename) diff --git a/src/ExchangePlugin/Test/TestExportPart_Results_2.py b/src/ExchangePlugin/Test/TestExportPart_Results_2.py index 5c9ab1119..25b901cba 100644 --- a/src/ExchangePlugin/Test/TestExportPart_Results_2.py +++ b/src/ExchangePlugin/Test/TestExportPart_Results_2.py @@ -72,3 +72,5 @@ model.begin() model.exportPart(partSet, filename, [featureToExport.result()]) model.end() assert os.path.exists(filename), "ERROR: Cannot export feature {}".format(featureToExport.name()) + +model.removeTmpFile(filename) diff --git a/src/ExchangePlugin/Test/TestExportPart_Results_3.py b/src/ExchangePlugin/Test/TestExportPart_Results_3.py index dfd89d55a..0da0b6069 100644 --- a/src/ExchangePlugin/Test/TestExportPart_Results_3.py +++ b/src/ExchangePlugin/Test/TestExportPart_Results_3.py @@ -72,3 +72,5 @@ model.begin() model.exportPart(Part_1_doc, filename, [featureToExport.result()]) model.end() assert os.path.exists(filename), "ERROR: Cannot export feature {}".format(featureToExport.name()) + +model.removeTmpFile(filename) diff --git a/src/ExchangePlugin/Test/TestExportPart_Results_7.py b/src/ExchangePlugin/Test/TestExportPart_Results_7.py index 46e43ac2c..4336c5658 100644 --- a/src/ExchangePlugin/Test/TestExportPart_Results_7.py +++ b/src/ExchangePlugin/Test/TestExportPart_Results_7.py @@ -72,3 +72,5 @@ model.begin() model.exportPart(Part_2_doc, filename, [featureToExport.result()]) model.end() assert os.path.exists(filename), "ERROR: Cannot export feature {}".format(featureToExport.name()) + +model.removeTmpFile(filename) diff --git a/src/ExchangePlugin/Test/TestExportPart_Results_8.py b/src/ExchangePlugin/Test/TestExportPart_Results_8.py index 6e4bf701a..a0933e959 100644 --- a/src/ExchangePlugin/Test/TestExportPart_Results_8.py +++ b/src/ExchangePlugin/Test/TestExportPart_Results_8.py @@ -72,3 +72,4 @@ model.begin() model.exportPart(Part_2_doc, filename, [featureToExport.result()]) model.end() assert os.path.exists(filename), "ERROR: Cannot export feature {}".format(featureToExport.name()) +model.removeTmpFile(filename) diff --git a/src/ExchangePlugin/Test/TestImportPart_AfterCurrent_1.py b/src/ExchangePlugin/Test/TestImportPart_AfterCurrent_1.py index 08f769187..86e5db84d 100644 --- a/src/ExchangePlugin/Test/TestImportPart_AfterCurrent_1.py +++ b/src/ExchangePlugin/Test/TestImportPart_AfterCurrent_1.py @@ -95,6 +95,8 @@ model.begin() model.importPart(Part_1_doc, filename, Sketch_1) model.end() +model.removeTmpFile(filename) + # compare results with the reference data TOLERANCE = 1.e-7 features = Part_1_doc.allFeatures() diff --git a/src/ExchangePlugin/Test/TestImportPart_AfterCurrent_2.py b/src/ExchangePlugin/Test/TestImportPart_AfterCurrent_2.py index e592da11d..f38af5faa 100644 --- a/src/ExchangePlugin/Test/TestImportPart_AfterCurrent_2.py +++ b/src/ExchangePlugin/Test/TestImportPart_AfterCurrent_2.py @@ -94,6 +94,8 @@ model.begin() model.importPart(Part_1_doc, filename, Extrusion_1) model.end() +model.removeTmpFile(filename) + # compare results with the reference data TOLERANCE = 1.e-7 features = Part_1_doc.allFeatures() diff --git a/src/ExchangePlugin/Test/TestImportPart_AfterLast_1.py b/src/ExchangePlugin/Test/TestImportPart_AfterLast_1.py index a8598cb56..9f79cf9c9 100644 --- a/src/ExchangePlugin/Test/TestImportPart_AfterLast_1.py +++ b/src/ExchangePlugin/Test/TestImportPart_AfterLast_1.py @@ -122,6 +122,8 @@ model.begin() model.importPart(Part_1_doc, filename) model.end() +model.removeTmpFile(filename) + # compare results with the reference data TOLERANCE = 1.e-7 features = Part_1_doc.allFeatures() diff --git a/src/ExchangePlugin/Test/TestImportPart_AfterLast_2.py b/src/ExchangePlugin/Test/TestImportPart_AfterLast_2.py index ca89a92c2..f26bea8ba 100644 --- a/src/ExchangePlugin/Test/TestImportPart_AfterLast_2.py +++ b/src/ExchangePlugin/Test/TestImportPart_AfterLast_2.py @@ -127,6 +127,8 @@ model.begin() model.importPart(Part_1_doc, filename) model.end() +model.removeTmpFile(filename) + # compare results with the reference data TOLERANCE = 1.e-7 features = Part_1_doc.allFeatures() diff --git a/src/ExchangePlugin/Test/TestImportPart_AfterLast_3.py b/src/ExchangePlugin/Test/TestImportPart_AfterLast_3.py index d484fea36..65f80f94d 100644 --- a/src/ExchangePlugin/Test/TestImportPart_AfterLast_3.py +++ b/src/ExchangePlugin/Test/TestImportPart_AfterLast_3.py @@ -123,6 +123,8 @@ model.begin() model.importPart(Part_1_doc, filename) model.end() +model.removeTmpFile(filename) + # compare results with the reference data TOLERANCE = 1.e-7 features = Part_1_doc.allFeatures() diff --git a/src/ExchangePlugin/Test/TestImportPart_AfterLast_4.py b/src/ExchangePlugin/Test/TestImportPart_AfterLast_4.py index 1acff3aa6..9c2c40d66 100644 --- a/src/ExchangePlugin/Test/TestImportPart_AfterLast_4.py +++ b/src/ExchangePlugin/Test/TestImportPart_AfterLast_4.py @@ -123,6 +123,8 @@ model.begin() model.importPart(Part_1_doc, filename) model.end() +model.removeTmpFile(filename) + # compare results with the reference data TOLERANCE = 1.e-7 features = Part_1_doc.allFeatures() diff --git a/src/ExchangePlugin/Test/TestImportPart_AfterLast_5.py b/src/ExchangePlugin/Test/TestImportPart_AfterLast_5.py index e7fafe376..4994315df 100644 --- a/src/ExchangePlugin/Test/TestImportPart_AfterLast_5.py +++ b/src/ExchangePlugin/Test/TestImportPart_AfterLast_5.py @@ -122,6 +122,8 @@ model.begin() model.importPart(Part_1_doc, filename) model.end() +model.removeTmpFile(filename) + # compare results with the reference data TOLERANCE = 1.e-7 features = Part_1_doc.allFeatures() diff --git a/src/ExchangePlugin/Test/TestImportPart_AfterLast_6.py b/src/ExchangePlugin/Test/TestImportPart_AfterLast_6.py index 3c3419b71..7bcb2accc 100644 --- a/src/ExchangePlugin/Test/TestImportPart_AfterLast_6.py +++ b/src/ExchangePlugin/Test/TestImportPart_AfterLast_6.py @@ -123,6 +123,8 @@ model.begin() model.importPart(Part_1_doc, filename) model.end() +model.removeTmpFile(filename) + # compare results with the reference data TOLERANCE = 1.e-7 features = Part_1_doc.allFeatures() diff --git a/src/ExchangePlugin/Test/TestImportPart_Construction_1.py b/src/ExchangePlugin/Test/TestImportPart_Construction_1.py index e04b7151e..45f2a163d 100644 --- a/src/ExchangePlugin/Test/TestImportPart_Construction_1.py +++ b/src/ExchangePlugin/Test/TestImportPart_Construction_1.py @@ -67,6 +67,8 @@ partSet = model.moduleDocument() model.importPart(partSet, filename) model.end() +model.removeTmpFile(filename) + # Test 1. No Part should be created assert(partSet.size(ModelAPI_ResultPart.group()) == 0) diff --git a/src/ExchangePlugin/Test/TestImportPart_Construction_2.py b/src/ExchangePlugin/Test/TestImportPart_Construction_2.py index 2f8c0c992..fdcef6ed6 100644 --- a/src/ExchangePlugin/Test/TestImportPart_Construction_2.py +++ b/src/ExchangePlugin/Test/TestImportPart_Construction_2.py @@ -71,6 +71,8 @@ Part_1_doc = Part_1.document() model.importPart(Part_1_doc, filename) model.end() +model.removeTmpFile(filename) + # Test 1. No Part should be created assert(partSet.size(ModelAPI_ResultPart.group()) == 1) diff --git a/src/ExchangePlugin/Test/TestImportPart_Construction_3.py b/src/ExchangePlugin/Test/TestImportPart_Construction_3.py index 21a9d696e..bf71fc6c5 100644 --- a/src/ExchangePlugin/Test/TestImportPart_Construction_3.py +++ b/src/ExchangePlugin/Test/TestImportPart_Construction_3.py @@ -69,6 +69,8 @@ partSet = model.moduleDocument() model.importPart(partSet, filename) model.end() +model.removeTmpFile(filename) + # Test 1. No new Part should be created assert(partSet.size(ModelAPI_ResultPart.group()) == 0) diff --git a/src/ExchangePlugin/Test/TestImportPart_Construction_4.py b/src/ExchangePlugin/Test/TestImportPart_Construction_4.py index a5cb1d09c..d64d31368 100644 --- a/src/ExchangePlugin/Test/TestImportPart_Construction_4.py +++ b/src/ExchangePlugin/Test/TestImportPart_Construction_4.py @@ -71,6 +71,8 @@ Part_1_doc = Part_1.document() model.importPart(Part_1_doc, filename) model.end() +model.removeTmpFile(filename) + # Test 1. No new Part should be created assert(partSet.size(ModelAPI_ResultPart.group()) == 1) diff --git a/src/ExchangePlugin/Test/TestImportPart_Multiple.py b/src/ExchangePlugin/Test/TestImportPart_Multiple.py index d8e5945c1..c42297d39 100644 --- a/src/ExchangePlugin/Test/TestImportPart_Multiple.py +++ b/src/ExchangePlugin/Test/TestImportPart_Multiple.py @@ -112,4 +112,6 @@ model.importPart(Part_1_doc, filename, Translation_1) model.end() checkUniqueNames(Part_1_doc) +model.removeTmpFile(filename) + assert(model.checkPythonDump()) diff --git a/src/ExchangePlugin/Test/TestImportPart_ToEmptyPart.py b/src/ExchangePlugin/Test/TestImportPart_ToEmptyPart.py index 20db0466f..d160136f6 100644 --- a/src/ExchangePlugin/Test/TestImportPart_ToEmptyPart.py +++ b/src/ExchangePlugin/Test/TestImportPart_ToEmptyPart.py @@ -87,6 +87,8 @@ Part_1_doc = Part_1.document() model.importPart(Part_1_doc, filename) model.end() +model.removeTmpFile(filename) + # Test 1. No new Part should be created assert(partSet.size(ModelAPI_ResultPart.group()) == 1) diff --git a/src/ExchangePlugin/Test/TestImportPart_ToEmptyPartSet.py b/src/ExchangePlugin/Test/TestImportPart_ToEmptyPartSet.py index b0f2a13b2..990419f72 100644 --- a/src/ExchangePlugin/Test/TestImportPart_ToEmptyPartSet.py +++ b/src/ExchangePlugin/Test/TestImportPart_ToEmptyPartSet.py @@ -85,6 +85,8 @@ partSet = model.moduleDocument() model.importPart(partSet, filename) model.end() +model.removeTmpFile(filename) + # Test 1. New Part should be created assert(partSet.size(ModelAPI_ResultPart.group()) == 1) newPart = modelAPI_ResultPart(objectToResult(partSet.object(ModelAPI_ResultPart.group(), 0))) diff --git a/src/PythonAPI/model/services/__init__.py b/src/PythonAPI/model/services/__init__.py index 1e5132e11..0a0c7aa89 100644 --- a/src/PythonAPI/model/services/__init__.py +++ b/src/PythonAPI/model/services/__init__.py @@ -74,6 +74,7 @@ def checkPythonDump(theDumpMode = CHECK_NAMING_AND_GEOMETRICAL): aGeo = aPrefix + "_geo.py" aWeak = aPrefix + "_weak.py" isOk = checkPyDump(aNaming, aGeo, aWeak, theDumpMode) + removeTmpFile(aPrefix) removeTmpFile(aNaming) removeTmpFile(aGeo) removeTmpFile(aWeak) -- 2.39.2