Salome HOME
Merge Python 3 porting.
[modules/kernel.git] / src / Launcher / Test / test_launcher.py
index c9f02549fc84f42428c113a4437ee27ba85d6b6e..920c9034b53e0b86c0ef4384992bd66b437a102f 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));
 
   ##############################
@@ -107,7 +107,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
@@ -117,11 +117,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")
@@ -209,7 +209,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
@@ -224,11 +224,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
@@ -314,7 +314,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
@@ -330,14 +330,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")
@@ -428,7 +428,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 +444,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")