Salome HOME
Add SQUISH test for export/import XAO
[modules/shaper.git] / test.squish / shared / scripts / common.py
index 06ce67bfa82b1812f4ba2f6f6ccf5fe17e98534f..13be8e77c98e6d3c253690b4cb92469345b7d84f 100644 (file)
@@ -1,9 +1,12 @@
+import filecmp
 import os
+import shutil
 
 testSettings.logScreenshotOnError = True
 testSettings.logScreenshotOnFail = True
 # RESULTS_PATH = "/dn48/SHAPER/eso/sources/test.squish/shared/testresults/"
 DATA_PATH = os.getenv('TEST_DATA_DIR')
+TMP_DIR = os.path.join(DATA_PATH, 'tmp')
 
 g_points = {"XY_plane": (332, 250), "XZ_plane": (355, 207)}  # one of the construction planes
 def help_points(name):
@@ -25,9 +28,19 @@ def getPropertyPanelRealName():
 def getSpinBoxRealName(name):
     return "{container=%s name='%s' type='ModuleBase_ParamSpinBox' visible='1'}" % (getPropertyPanelRealName(), name)
 
+#---------------------------------------------------------------------------------------------
+def create_tmp():
+    remove_tmp()
+    os.makedirs(TMP_DIR)
+
+def remove_tmp():
+    if os.path.exists(TMP_DIR):
+        shutil.rmtree(TMP_DIR)
+
 #---------------------------------------------------------------------------------------------
 def set_defaults():
     waitForObject(":SALOME*_STD_TabDesktop").resize(1024, 768)
+    create_tmp()
 
 def activate_SHAPER():
     clickButton(waitForObject(":SALOME*.Shaper_QToolButton"))
@@ -38,11 +51,13 @@ def close_application():
     clickButton(waitForObject(":Exit.Ok_QPushButton"))
     clickButton(waitForObject(":Close active study.Close w/o saving_QPushButton"))
 #     snooze(10)
+    remove_tmp()
 
 def close_application_wo_saving():
     sendEvent("QCloseEvent", waitForObject(":SALOME*_STD_TabDesktop"))
     clickButton(waitForObject(":Exit.Ok_QPushButton"))
     clickButton(waitForObject(":Close active study.Close w/o saving_QPushButton"))
+    remove_tmp()
 
 def part_create():
     activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part"))