Salome HOME
Update the tests
authorSerge Rehbinder <serge.rehbinder@cea.fr>
Thu, 21 Apr 2016 07:10:24 +0000 (09:10 +0200)
committerSerge Rehbinder <serge.rehbinder@cea.fr>
Thu, 21 Apr 2016 07:10:24 +0000 (09:10 +0200)
commands/prepare.py
test/config/option_copy.py
test/config/option_edit.py
test/config/option_value.py
test/log/launch_browser.py
test/prepare/test_patch.py
test/prepare/test_prepare.py
test/prepare/test_source.py

index eeb47d23974305fdb273059087cee3df909f0192..073e980de44c7fa18aee63326debfe209a26934e 100644 (file)
@@ -16,6 +16,8 @@
 #  License along with this library; if not, write to the Free Software
 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 
+import re
+
 import src
 
 # Define all possible option for prepare command :  sat prepare <options>
@@ -132,19 +134,35 @@ def run(args, runner, logger):
                                                  ldev_products,
                                                  logger)
         logger.write("\n", 1)
-    
+
     # Construct the final commands arguments
     args_clean = args_appli + args_product_opt_clean + " --source"
     args_source = args_appli + args_product_opt  
     args_patch = args_appli + args_product_opt_patch
+
+    # If there is no more any product in the command arguments,
+    # do not call the concerned command 
+    oExpr = re.compile("^--product *$")
+    do_clean = not(oExpr.search(args_product_opt_clean))
+    do_source = not(oExpr.search(args_product_opt))
+    do_patch = not(oExpr.search(args_product_opt_patch))
+    
+    
+    # Initialize the results to a failing status
+    res_clean = 1
+    res_source = 1
+    res_patch = 1
     
     # Call the commands using the API
-    msg = _("Clean the source directories ...")
-    logger.write(msg, 3)
-    res_clean = runner.clean(args_clean, batch=True, verbose = 0)
-    if res_clean == 0:
-        logger.write('%s\n' % src.printcolors.printc(src.OK_STATUS), 3)
-    res_source = runner.source(args_source)
-    res_patch = runner.patch(args_patch)
+    if do_clean:
+        msg = _("Clean the source directories ...")
+        logger.write(msg, 3)
+        res_clean = runner.clean(args_clean, batch=True, verbose = 0)
+        if res_clean == 0:
+            logger.write('%s\n\n' % src.printcolors.printc(src.OK_STATUS), 3)
+    if do_source:
+        res_source = runner.source(args_source)
+    if do_patch:
+        res_patch = runner.patch(args_patch)
     
     return res_clean + res_source + res_patch
\ No newline at end of file
index 4f709949ee764beca8f95c0e7ff83e67bfa60d85..d671383d85cd4dbd2e463911ab5dda5f77f8ecff 100644 (file)
@@ -19,7 +19,6 @@
 import unittest
 import os
 import sys
-import shutil
 
 # get execution path
 testdir = os.path.dirname(os.path.realpath(__file__))
index f0a1b130b3a7105185a891bcb7ccacc1fe72ca07..c156419a9fdad05dc025f6c47aef276af42be0a8 100644 (file)
@@ -28,8 +28,6 @@ sys.path.append(os.path.join(testdir, '..', '..'))
 sys.path.append(os.path.join(testdir, '..', '_testTools'))
 
 from salomeTools import Sat
-import src
-from tools import outRedirection
 from tools import check_proc_existence_and_kill
 import HTMLTestRunner
 
index b6b80556cd76097f17a32733b8d08abbe617daa1..678d3f0b53e5b3fb3c6fa150bc1a2cdf53f962f6 100644 (file)
@@ -20,7 +20,6 @@ import unittest
 import os
 import sys
 import platform
-import shutil
 
 # get execution path
 testdir = os.path.dirname(os.path.realpath(__file__))
@@ -28,7 +27,6 @@ sys.path.append(os.path.join(testdir, '..', '..'))
 sys.path.append(os.path.join(testdir, '..', '_testTools'))
 
 from salomeTools import Sat
-import src
 from tools import outRedirection
 import HTMLTestRunner
 
index c7f910406596cd921902a1e46e1b0b7d2270a83e..9d62d861008aa4b6031a23bb67b136e74e24ded3 100644 (file)
@@ -32,9 +32,7 @@ sys.path.append(os.path.join(testdir, '..', '..','commands'))
 
 from salomeTools import Sat
 from tools import check_proc_existence_and_kill
-from tools import outRedirection
 import HTMLTestRunner
-import src.xmlManager
 
 sleep_time = 2
 
index eb014be9bba42c91f6468ad65aab0c9f81c252ba..5da0fb2717c3ce7ad89467901d4d9511f1afa5fb 100644 (file)
@@ -122,7 +122,7 @@ class TestPatch(unittest.TestCase):
         appli = 'appli-test'
         product_name = 'PRODUCT_ARCHIVE'
 
-        sat = Sat()
+        sat = Sat('-v4')
                       
         sat.source(appli + ' --product ' + product_name)
                
index f03b6c895b3990407fe9675d81fa315ddbc89c65..bebeecac721e7df266bcb3affa501adeb7d203be 100644 (file)
@@ -29,8 +29,6 @@ sys.path.append(os.path.join(testdir, '..', '..','commands'))
 
 import src
 
-from tools import outRedirection
-
 from salomeTools import Sat
 import HTMLTestRunner
 
@@ -106,7 +104,7 @@ class TestPrepare(unittest.TestCase):
         sat.config(appli)
        
         try:
-            sat.prepare(appli + " --no_sample --force")
+            sat.prepare(appli + " --force --force_patch")
             OK = 'OK'
         except:
             pass
index 12831eff91a8ba2befebd36e4464fb0c5016241d..900b94b060e3e18de8cc59f506fa2f8d03f3615a 100644 (file)
@@ -19,7 +19,6 @@
 import unittest
 import os
 import sys
-import shutil
 
 # get execution path
 testdir = os.path.dirname(os.path.realpath(__file__))
@@ -132,7 +131,7 @@ class TestSource(unittest.TestCase):
         sat = Sat()
         sat.source(appli + ' --product ' + product_name)
 
-        expected_src_dir = os.path.join(sat.cfg.APPLICATION.out_dir, 'SOURCES', product_name)
+        expected_src_dir = os.path.join(sat.cfg.APPLICATION.workdir, 'SOURCES', product_name)
         if not os.path.exists(expected_src_dir):
             OK = 'OK'
 
@@ -184,68 +183,6 @@ class TestSource(unittest.TestCase):
         # pyunit method to compare 2 str
         self.assertEqual(OK, 'OK')
 
-    def test_source_dev(self):
-        '''Test the source command with a product in dev mode
-        '''
-        OK = 'KO'
-
-        appli = 'appli-test'
-        product_name = 'PRODUCT_DEV'
-
-        sat = Sat()
-               
-        sat.config(appli)
-        
-        expected_src_dir = src.product.get_product_config(sat.cfg, product_name).source_dir
-        expected_file_path = os.path.join(expected_src_dir, 'my_test_file.txt')
-        expected_text = 'HELLO WORLD\n'
-        
-        if os.path.exists(expected_src_dir):
-            shutil.rmtree(expected_src_dir)
-        
-        sat.source(appli + ' --product ' + product_name)
-        
-        f = open(expected_file_path, 'r')
-        text = f.readlines()[0]
-        OK1 = 'KO'
-        if text == expected_text:
-            OK1 = 'OK'
-
-        # output redirection
-        my_out = outRedirection()
-        
-        sat.source(appli + ' --product ' + product_name)
-        
-        # stop output redirection
-        my_out.end_redirection()
-
-        # get results
-        res = my_out.read_results()
-
-        OK2 = 'KO'
-        if "source directory already exists" in res:
-            OK2 = 'OK'        
-
-        # output redirection
-        my_out = outRedirection()
-        
-        sat.source(appli + ' --product ' + product_name + ' --force')
-        
-        # stop output redirection
-        my_out.end_redirection()
-
-        # get results
-        res = my_out.read_results()
-
-        OK3 = 'KO'
-        if "source directory already exists" not in res:
-            OK3 = 'OK'         
-
-        if (OK1, OK2, OK3)==('OK', 'OK', 'OK'):
-            OK = 'OK'
-
-        # pyunit method to compare 2 str
-        self.assertEqual(OK, 'OK')
 
     def test_description(self):
         '''Test the sat -h source