Salome HOME
style: black format
[tools/sat.git] / test / test_sat5_0 / job / test_job.py
index fc231913313207f03ef4ddecdd1a3f9b64d56449..d255fd08eaa8c9f62fb711f93e47f2b65ac14ee6 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/env python
-#-*- coding:utf-8 -*-
+# -*- coding:utf-8 -*-
 
 #  Copyright (C) 2010-2018  CEA/DEN
 #
@@ -23,100 +23,106 @@ import unittest
 
 from src.salomeTools import Sat
 
+
 class TestCase(unittest.TestCase):
     """Test the job command"""
 
     def test_010(self):
         # Test the job command
-        OK = 'KO'
+        OK = "KO"
         tmp_file = "/tmp/test.txt"
 
         sat = Sat("-l " + tmp_file)
-        
+
         # Execute the job command
-        sat.job("--jobs_config .test --name Job 1" )
+        sat.job("--jobs_config .test --name Job 1")
 
         ff = open(tmp_file, "r")
         log_files = ff.readlines()
         ff.close()
         os.remove(tmp_file)
-        log_config = [line.replace("\n", "") for line in log_files if 'config.xml' in line]
-        
+        log_config = [
+            line.replace("\n", "") for line in log_files if "config.xml" in line
+        ]
+
         text = open(log_config[0], "r").read()
 
         if "nb_proc" in text:
-            OK = 'OK'         
-        self.assertEqual(OK, 'OK')
-
+            OK = "OK"
+        self.assertEqual(OK, "OK")
 
     def test_020(self):
         # Test the job command with a failing command
-        OK = 'KO'
+        OK = "KO"
         tmp_file = "/tmp/test.txt"
 
         sat = Sat("-l " + tmp_file)
-        
+
         # Execute the job command
-        res = sat.job("--jobs_config .test --name Job 4" )
+        res = sat.job("--jobs_config .test --name Job 4")
 
         if res == 1:
-            OK = 'OK'         
+            OK = "OK"
         # pyunit method to compare 2 str
-        self.assertEqual(OK, 'OK')
+        self.assertEqual(OK, "OK")
 
     def test_030(self):
         # Test the job command with a wrong file configuration
-        OK = 'KO'
+        OK = "KO"
         tmp_file = "/tmp/test.txt"
 
         sat = Sat("-l " + tmp_file)
-        
+
         # Execute the job command
-        res = sat.job("--jobs_config NOTEXIST --name Job 4" )
+        res = sat.job("--jobs_config NOTEXIST --name Job 4")
 
         if res == 1:
-            OK = 'OK'         
-        self.assertEqual(OK, 'OK')
+            OK = "OK"
+        self.assertEqual(OK, "OK")
 
     def test_040(self):
         # Test the job command without --jobs_config option
-        OK = 'KO'
+        OK = "KO"
         tmp_file = "/tmp/test.txt"
 
         sat = Sat("-l " + tmp_file)
-        
+
         # Execute the job command
-        res = sat.job("--name Job 4" )
+        res = sat.job("--name Job 4")
 
         if res == 1:
-            OK = 'OK'         
-        self.assertEqual(OK, 'OK')
+            OK = "OK"
+        self.assertEqual(OK, "OK")
 
     def test_050(self):
         # Test the job command without --jobs_config option
-        OK = 'KO'
+        OK = "KO"
         tmp_file = "/tmp/test.txt"
 
         sat = Sat("-l " + tmp_file)
-        
+
         # Execute the job command
-        res = sat.job("--jobs_config .test --name NOTEXIST" )
+        res = sat.job("--jobs_config .test --name NOTEXIST")
 
         if res == 1:
-            OK = 'OK'         
-        self.assertEqual(OK, 'OK')
+            OK = "OK"
+        self.assertEqual(OK, "OK")
 
     def test_060(self):
-        # Test the sat -h job     
+        # Test the sat -h job
         OK = "KO"
 
         import job
-        
-        if "Executes the commands of the job defined in the jobs configuration file" in job.description():
+
+        if (
+            "Executes the commands of the job defined in the jobs configuration file"
+            in job.description()
+        ):
             OK = "OK"
         self.assertEqual(OK, "OK")
 
+
 # test launch
-if __name__ == '__main__':
+if __name__ == "__main__":
     unittest.main()
     pass