Salome HOME
style: black format
[tools/sat.git] / test / test_sat5_0 / prepare / test_clean.py
index 08bb54f1a3d6bd5f963207e1c9fc97a7e7ab4179..3203654a4127382e04ea87aedac1051e6c8e708a 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/env python
-#-*- coding:utf-8 -*-
+# -*- coding:utf-8 -*-
 
 #  Copyright (C) 2010-2018  CEA/DEN
 #
@@ -25,49 +25,52 @@ from src.salomeTools import Sat
 import src.product
 from unittestpy.tools import outRedirection
 
+
 class TestCase(unittest.TestCase):
     """Test of the clean command"""
 
     def test_010(self):
         # Test the clean command with no arguments (nothing to clean)
-        OK = 'KO'
+        OK = "KO"
 
-        appli = 'appli-test'
+        appli = "appli-test"
 
         sat = Sat()
 
         # output redirection
         my_out = outRedirection()
-        
+
         sat.clean(appli)
-        
+
         # stop output redirection
         my_out.end_redirection()
 
         # get results
         res = my_out.read_results()
-        
+
         if "Nothing to suppress" in res:
-            OK = 'OK'
-        self.assertEqual(OK, 'OK')
+            OK = "OK"
+        self.assertEqual(OK, "OK")
 
     def test_020(self):
         # Test the clean of sources
         OK = "KO"
 
-        appli = 'appli-test'
+        appli = "appli-test"
         product_name = "PRODUCT_GIT"
 
-        sat = Sat()      
-        
+        sat = Sat()
+
         # Make sure the sources exist
         sat.prepare(appli + " -p " + product_name)
-        
+
         # Call the command
         sat.clean(appli + " -p " + product_name + " --sources", batch=True)
-           
-        expected_src_dir = src.product.get_product_config(sat.cfg, product_name).source_dir
-        
+
+        expected_src_dir = src.product.get_product_config(
+            sat.cfg, product_name
+        ).source_dir
+
         if not os.path.exists(expected_src_dir):
             OK = "OK"
         self.assertEqual(OK, "OK")
@@ -76,20 +79,22 @@ class TestCase(unittest.TestCase):
         # Test the clean of build
         OK = "KO"
 
-        appli = 'appli-test'
+        appli = "appli-test"
         product_name = "PRODUCT_GIT"
 
-        sat = Sat()      
-        
+        sat = Sat()
+
         # Make sure the build exists
         sat.prepare(appli + " -p " + product_name)
         sat.configure(appli + " -p " + product_name)
-        
+
         # Call the command
         sat.clean(appli + " -p " + product_name + " --build", batch=True)
-           
-        expected_build_dir = src.product.get_product_config(sat.cfg, product_name).build_dir
-        
+
+        expected_build_dir = src.product.get_product_config(
+            sat.cfg, product_name
+        ).build_dir
+
         if not os.path.exists(expected_build_dir):
             OK = "OK"
         self.assertEqual(OK, "OK")
@@ -98,20 +103,22 @@ class TestCase(unittest.TestCase):
         # Test the clean of install
         OK = "KO"
 
-        appli = 'appli-test'
+        appli = "appli-test"
         product_name = "PRODUCT_GIT"
 
-        sat = Sat()      
-        
+        sat = Sat()
+
         # Make sure the build exists
         sat.prepare(appli + " -p " + product_name)
         sat.configure(appli + " -p " + product_name)
-        
+
         # Call the command
         sat.clean(appli + " -p " + product_name + " --install", batch=True)
-           
-        expected_install_dir = src.product.get_product_config(sat.cfg, product_name).install_dir
-        
+
+        expected_install_dir = src.product.get_product_config(
+            sat.cfg, product_name
+        ).install_dir
+
         if not os.path.exists(expected_install_dir):
             OK = "OK"
         self.assertEqual(OK, "OK")
@@ -120,23 +127,33 @@ class TestCase(unittest.TestCase):
         # Test the clean of all (build, src, install)
         OK = "KO"
 
-        appli = 'appli-test'
+        appli = "appli-test"
         product_name = "PRODUCT_GIT"
 
-        sat = Sat()      
-        
+        sat = Sat()
+
         # Make sure the build exists
         sat.prepare(appli + " -p " + product_name)
         sat.compile(appli + " -p " + product_name)
-        
+
         # Call the command
         sat.clean(appli + " -p " + product_name + " --all", batch=True)
-           
-        expected_install_dir = src.product.get_product_config(sat.cfg, product_name).install_dir
-        expected_build_dir = src.product.get_product_config(sat.cfg, product_name).build_dir
-        expected_src_dir = src.product.get_product_config(sat.cfg, product_name).source_dir
-        
-        if not os.path.exists(expected_install_dir) and not os.path.exists(expected_build_dir) and not os.path.exists(expected_src_dir):
+
+        expected_install_dir = src.product.get_product_config(
+            sat.cfg, product_name
+        ).install_dir
+        expected_build_dir = src.product.get_product_config(
+            sat.cfg, product_name
+        ).build_dir
+        expected_src_dir = src.product.get_product_config(
+            sat.cfg, product_name
+        ).source_dir
+
+        if (
+            not os.path.exists(expected_install_dir)
+            and not os.path.exists(expected_build_dir)
+            and not os.path.exists(expected_src_dir)
+        ):
             OK = "OK"
         self.assertEqual(OK, "OK")
 
@@ -144,37 +161,44 @@ class TestCase(unittest.TestCase):
         # Test the clean with sources_without_dev option
         OK = "KO"
 
-        appli = 'appli-test'
+        appli = "appli-test"
         product_name = "PRODUCT_GIT"
         product_name2 = "PRODUCT_DEV"
 
-        sat = Sat()      
-        
+        sat = Sat()
+
         # Make sure the build exists
         sat.prepare(appli + " -p " + product_name + "," + product_name2)
-        
+
         # Call the command
         sat.clean(appli + " -p " + product_name + " --sources_without_dev", batch=True)
-           
-        expected_src_dir = src.product.get_product_config(sat.cfg, product_name).source_dir
-        expected_src_dir2 = src.product.get_product_config(sat.cfg, product_name2).source_dir
-        
+
+        expected_src_dir = src.product.get_product_config(
+            sat.cfg, product_name
+        ).source_dir
+        expected_src_dir2 = src.product.get_product_config(
+            sat.cfg, product_name2
+        ).source_dir
+
         if not os.path.exists(expected_src_dir) and os.path.exists(expected_src_dir2):
             OK = "OK"
         self.assertEqual(OK, "OK")
 
-
     def test_070(self):
         # Test the sat -h clean
         OK = "KO"
 
         import clean
-        
-        if "The clean command suppress the source, build, or install" in clean.description():
+
+        if (
+            "The clean command suppress the source, build, or install"
+            in clean.description()
+        ):
             OK = "OK"
         self.assertEqual(OK, "OK")
 
+
 # test launch
-if __name__ == '__main__':
+if __name__ == "__main__":
     unittest.main()
     pass