Salome HOME
style: black format
[tools/sat.git] / test / test_sat5_0 / log / test_launch_browser2.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 threading
23 import time
24 import unittest
25
26 from src.salomeTools import Sat
27 from unittestpy.tools import check_proc_existence_and_kill_multi
28
29 sleep_time = 2
30
31
32 class TestCase(unittest.TestCase):
33     """Test of log command: launch of browser"""
34
35     def test_010(self):
36         # Test the launch of browser when invoking the log command
37         OK = "KO"
38
39         sat = Sat("-oUSER.browser='konqueror'")
40         time.sleep(sleep_time)
41         cmd_log = threading.Thread(target=sat.log, args=("",))
42         cmd_log.start()
43
44         time.sleep(sleep_time)
45
46         sat.config("")
47         browser = sat.cfg.USER.browser
48         pid = check_proc_existence_and_kill_multi(browser + ".*" + "hat\.xml", 10)
49
50         if pid:
51             OK = "OK"
52         self.assertEqual(OK, "OK")
53
54
55 # test launch
56 if __name__ == "__main__":
57     unittest.main()
58     pass