]> SALOME platform Git repositories - tools/sat.git/blob - test/test_sat5_0/test/test_command.py
Salome HOME
option bin_products part 1
[tools/sat.git] / test / test_sat5_0 / test / test_command.py
1 #!/usr/bin/env python
2 #-*- coding:utf-8 -*-
3
4 #  Copyright (C) 2010-2018  CEA/DEN
5 #
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.
10 #
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.
15 #
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
19
20 import os
21 import sys
22 import unittest
23
24 from src.salomeTools import Sat
25
26 class TestTest(unittest.TestCase):
27     """Test of the test command"""
28
29     def test_010(self):
30         # Test the test command
31         OK = 'KO'
32         tmp_file = "/tmp/test.txt"
33         application = "SALOME-7.8.0"
34
35         sat = Sat("-l " + tmp_file)
36         
37         # Execute the job command
38         sat.test(application + " --grid GEOM --session light" )
39
40         ff = open(tmp_file, "r")
41         log_files = ff.readlines()
42         ff.close()
43         os.remove(tmp_file)
44         log_testboard = [line.replace("\n", "") for line in log_files if 'testboard.xml' in line]
45         
46         text = open(log_testboard[0], "r").read()
47
48         if '<session name="light">' in text:
49             OK = 'OK'         
50         self.assertEqual(OK, 'OK')
51
52     def test_020(self):
53         # Test the test command with PY type
54         OK = 'KO'
55         tmp_file = "/tmp/test.txt"
56         application = "SALOME-7.8.0"
57
58         sat = Sat("-l " + tmp_file)
59         
60         # Execute the job command
61         sat.test(application + " --grid MED --session PY_test_withKernel" )
62
63         ff = open(tmp_file, "r")
64         log_files = ff.readlines()
65         ff.close()
66         os.remove(tmp_file)
67         log_testboard = [line.replace("\n", "") for line in log_files if 'testboard.xml' in line]
68         
69         text = open(log_testboard[0], "r").read()
70
71         if '<session name="PY_test_withKernel">' in text:
72             OK = 'OK'         
73         self.assertEqual(OK, 'OK')
74
75     def test_030(self):
76         # Test the sat -h test
77         OK = "KO"
78
79         import test
80         
81         if "The test command runs a test base on a SALOME installation" in test.description():
82             OK = "OK"
83         self.assertEqual(OK, "OK")
84
85 # test launch
86 if __name__ == '__main__':
87     unittest.main()
88     pass