Salome HOME
Merge branch 'BR_8_3' of https://codev-tuleap.cea.fr/plugins/git/spns/SAT into BR_8_3
[tools/sat.git] / test / config / option_value_2.py
1 #!/usr/bin/env python
2 #-*- coding:utf-8 -*-
3 #  Copyright (C) 2010-2012  CEA/DEN
4 #
5 #  This library is free software; you can redistribute it and/or
6 #  modify it under the terms of the GNU Lesser General Public
7 #  License as published by the Free Software Foundation; either
8 #  version 2.1 of the License.
9 #
10 #  This library is distributed in the hope that it will be useful,
11 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 #  Lesser General Public License for more details.
14 #
15 #  You should have received a copy of the GNU Lesser General Public
16 #  License along with this library; if not, write to the Free Software
17 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
18
19 import unittest
20 import os
21 import sys
22 import platform
23
24 # get execution path
25 testdir = os.path.dirname(os.path.realpath(__file__))
26 sys.path.append(os.path.join(testdir, '..', '..'))
27 sys.path.append(os.path.join(testdir, '..', '_testTools'))
28
29 from salomeTools import Sat
30 from tools import outRedirection
31 import HTMLTestRunner
32
33 class TestConfig(unittest.TestCase):
34     '''test of sat config -v VARS.python
35     '''
36     
37     def test_option_value(self):
38         '''Test the display of the right value of "sat config -v VARS.python"
39         '''
40         
41         OK = 'KO'
42
43         # output redirection
44         my_out = outRedirection()
45
46         # The command to test
47         sat = Sat('')
48         sat.config('-v VARS.python')
49
50         # stop output redirection
51         my_out.end_redirection()
52
53         # get results
54         res = my_out.read_results()
55         
56         
57         if platform.python_version() in res:
58             OK = 'OK'
59
60         # pyunit method to compare 2 str
61         self.assertEqual(OK, 'OK')
62
63     def test_option_schema(self):
64         '''Test the display of the right value of "sat config -s"
65         '''
66         
67         OK = 'KO'
68
69         # output redirection
70         my_out = outRedirection()
71
72         # The command to test
73         sat = Sat('')
74         sat.config('-s')
75
76         # stop output redirection
77         my_out.end_redirection()
78
79         # get results
80         res = my_out.read_results()
81         
82         
83         if 'INTERNAL' in res:
84             OK = 'OK'
85
86         # pyunit method to compare 2 str
87         self.assertEqual(OK, 'OK')
88         
89     def test_option_info(self):
90         '''Test the display of the right value of "sat config -i"
91         '''
92         
93         application = 'appli-test'
94         product = 'PRODUCT_DEV'
95         
96         OK = 'KO'
97
98         # output redirection
99         my_out = outRedirection()
100
101         # The command to test
102         sat = Sat('')
103         sat.config(application + ' --info ' + product)
104
105         # stop output redirection
106         my_out.end_redirection()
107
108         # get results
109         res = my_out.read_results()
110         
111         
112         if 'compilation method = cmake' in res:
113             OK = 'OK'
114
115         # pyunit method to compare 2 str
116         self.assertEqual(OK, 'OK')
117
118 # test launch
119 if __name__ == '__main__':
120     HTMLTestRunner.main()