Salome HOME
Merge V9_dev branch into master
[modules/kernel.git] / src / Launcher / Test / test_launcher.py
index 5087d66998bfffe149172b6e6522321616554604..339e4c8751b67e843c8e78a79a4528f7775544b5 100755 (executable)
@@ -58,7 +58,7 @@ class TestCompo(unittest.TestCase):
       text = f.read()
       f.close()
       self.assertEqual(text, content)
-    except IOError,ex:
+    except IOError as ex:
       self.fail("IO exception:" + str(ex));
 
   def create_JobParameters(self):
@@ -112,7 +112,7 @@ f.close()
     launcher = salome.naming_service.Resolve('/SalomeLauncher')
 
     for resource in self.ressources:
-      print "Testing python_salome job on ", resource
+      print("Testing python_salome job on ", resource)
       job_params.result_directory = local_result_dir + resource
       job_params.job_name = "PyJob" + resource
       job_params.resource_required.name = resource
@@ -122,11 +122,11 @@ f.close()
       launcher.launchJob(job_id)
 
       jobState = launcher.getJobState(job_id)
-      print "Job %d state: %s" % (job_id,jobState)
+      print("Job %d state: %s" % (job_id,jobState))
       while jobState != "FINISHED" and jobState != "FAILED" :
         time.sleep(5)
         jobState = launcher.getJobState(job_id)
-        print "Job %d state: %s" % (job_id,jobState)
+        print("Job %d state: %s" % (job_id,jobState))
         pass
 
       self.assertEqual(jobState, "FINISHED")
@@ -212,7 +212,7 @@ f.close()
     resManager= salome.lcc.getResourcesManager()
 
     for resource in self.ressources:
-      print "Testing command job on ", resource
+      print("Testing command job on ", resource)
       job_params.result_directory = local_result_dir + resource
       job_params.job_name = "CommandJob_" + resource
       job_params.resource_required.name = resource
@@ -227,11 +227,11 @@ f.close()
       launcher.launchJob(job_id)
       # wait for the end of the job
       jobState = launcher.getJobState(job_id)
-      print "Job %d state: %s" % (job_id,jobState)
+      print("Job %d state: %s" % (job_id,jobState))
       while jobState != "FINISHED" and jobState != "FAILED" :
         time.sleep(3)
         jobState = launcher.getJobState(job_id)
-        print "Job %d state: %s" % (job_id,jobState)
+        print("Job %d state: %s" % (job_id,jobState))
         pass
 
       # verify the results
@@ -277,7 +277,6 @@ f.close()
     # job script
     script_text = """<?xml version='1.0' encoding='iso-8859-1' ?>
 <proc name="newSchema_1">
-   <property name="DefaultStudyID" value="1"/>
    <container name="DefaultContainer">
       <property name="container_kind" value="Salome"/>
       <property name="attached_on_cloning" value="0"/>
@@ -316,7 +315,7 @@ f.close()
     resManager= salome.lcc.getResourcesManager()
 
     for resource in self.ressources:
-      print "Testing yacs job on ", resource
+      print("Testing yacs job on ", resource)
       job_params.result_directory = local_result_dir + resource
       job_params.job_name = "YacsJob_" + resource
       job_params.resource_required.name = resource
@@ -332,14 +331,14 @@ f.close()
       jobState = launcher.getJobState(job_id)
 
       yacs_dump_success = False
-      print "Job %d state: %s" % (job_id,jobState)
+      print("Job %d state: %s" % (job_id,jobState))
       while jobState != "FINISHED" and jobState != "FAILED" :
         time.sleep(5)
         jobState = launcher.getJobState(job_id)
 #        yacs_dump_success = launcher.getJobWorkFile(job_id, "dumpState_mySchema.xml",
         yacs_dump_success = launcher.getJobDumpState(job_id,
                                               job_params.result_directory)
-        print "Job %d state: %s - dump: %s" % (job_id,jobState, yacs_dump_success)
+        print("Job %d state: %s - dump: %s" % (job_id,jobState, yacs_dump_success))
         pass
 
       self.assertEqual(jobState, "FINISHED")
@@ -380,7 +379,6 @@ f.close()
     # job script
     script_text = """<?xml version='1.0' encoding='iso-8859-1' ?>
 <proc name="myschema">
-   <property name="DefaultStudyID" value="1"/>
    <type name="string" kind="string"/>
    <type name="bool" kind="bool"/>
    <type name="double" kind="double"/>
@@ -428,7 +426,7 @@ f.close()
     resManager= salome.lcc.getResourcesManager()
 
     for resource in self.ressources:
-      print "Testing yacs job with options on ", resource
+      print("Testing yacs job with options on ", resource)
       job_params.result_directory = local_result_dir + resource
       job_params.job_name = "YacsJobOpt_" + resource
       job_params.resource_required.name = resource
@@ -444,11 +442,11 @@ f.close()
       jobState = launcher.getJobState(job_id)
 
       yacs_dump_success = False
-      print "Job %d state: %s" % (job_id,jobState)
+      print("Job %d state: %s" % (job_id,jobState))
       while jobState != "FINISHED" and jobState != "FAILED" :
         time.sleep(5)
         jobState = launcher.getJobState(job_id)
-        print "Job %d state: %s " % (job_id,jobState)
+        print("Job %d state: %s " % (job_id,jobState))
         pass
 
       self.assertEqual(jobState, "FINISHED")