4 # Copyright (C) 2010-2018 CEA/DEN
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License.
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 from src.salomeTools import Sat
28 class TestCase(unittest.TestCase):
29 """Test of the prepare command"""
32 # Test the prepare command with a product in dev mode
36 product_name = 'PRODUCT_DEV'
42 expected_src_dir = src.product.get_product_config(sat.cfg, product_name).source_dir
43 expected_file_path = os.path.join(expected_src_dir, 'my_test_file.txt')
44 expected_text = 'HELLO WORLD\n'
46 if os.path.exists(expected_src_dir):
47 shutil.rmtree(expected_src_dir)
49 sat.prepare(appli + ' --product ' + product_name)
51 f = open(expected_file_path, 'r')
52 text = f.readlines()[0]
53 if text == expected_text:
55 self.assertEqual(OK, 'OK')
58 # Test the prepare command with all products
62 product_name = 'PRODUCT_DEV'
67 expected_src_dir = src.product.get_product_config(sat.cfg, product_name).source_dir
68 expected_file_path = os.path.join(expected_src_dir, 'my_test_file.txt')
69 expected_text = 'HELLO WORLD\n'
71 if os.path.exists(expected_src_dir):
72 shutil.rmtree(expected_src_dir)
76 f = open(expected_file_path, 'r')
77 text = f.readlines()[0]
78 if text == expected_text:
80 self.assertEqual(OK, 'OK')
83 # Test the prepare command with all products
92 sat.prepare(appli + " --force --force_patch")
96 self.assertEqual(OK, 'OK')
99 # Test the sat -h prepare
104 if "The prepare command gets the sources" in prepare.description():
106 self.assertEqual(OK, "OK")
109 if __name__ == '__main__':