equal
deleted
inserted
replaced
16 |
16 |
17 """ |
17 """ |
18 Test the configuration |
18 Test the configuration |
19 """ |
19 """ |
20 import unittest |
20 import unittest |
21 import string |
|
22 import sys |
|
23 import os |
21 import os |
24 import subprocess |
22 import re |
25 import __init__ |
23 |
26 from testautomation.base_testcase import BaseTestCase |
24 from testautomation.base_testcase import BaseTestCase |
27 from scripttest_common import get_cmd |
25 from scripttest_common import get_cmd |
28 |
26 |
29 ROOT_PATH = os.path.dirname(os.path.abspath(__file__)) |
27 ROOT_PATH = os.path.dirname(os.path.abspath(__file__)) |
30 |
28 |
31 class TestConeHelp(BaseTestCase): |
29 class TestConeHelp(BaseTestCase): |
|
30 |
|
31 def test_get_version(self): |
|
32 cmd = '%s --version' % get_cmd('') |
|
33 out = self.run_command(cmd) |
|
34 print "output from version %s" % out |
|
35 lines = out.split(os.linesep) |
|
36 self.assertTrue(re.match(r'^ConE\s+\d+\.\d+\.\d+.*$', lines[0])) |
32 |
37 |
33 def test_get_help(self): |
38 def test_get_help(self): |
34 cmd = '%s -h' % get_cmd('') |
39 cmd = '%s -h' % get_cmd('') |
35 out = self.run_command(cmd) |
40 out = self.run_command(cmd) |
36 lines = out.split(os.linesep) |
41 lines = out.split(os.linesep) |
38 |
43 |
39 def test_verbose_level(self): |
44 def test_verbose_level(self): |
40 cmd = '%s info --print-runtime-info --verbose=5' % get_cmd('') |
45 cmd = '%s info --print-runtime-info --verbose=5' % get_cmd('') |
41 out = self.run_command(cmd) |
46 out = self.run_command(cmd) |
42 # Check that there are debug messages in the output |
47 # Check that there are debug messages in the output |
43 self.assertTrue('DEBUG : cone' in out) |
48 self.assertTrue('DEBUG: cone' in out) |
44 self.assertTrue('sys.path contents:' in out) |
49 self.assertTrue('sys.path contents:' in out) |
45 |
50 |
46 def test_empty_verbose_level(self): |
51 def test_empty_verbose_level(self): |
47 cmd = '%s info --print-runtime-info --verbose=' % get_cmd('') |
52 cmd = '%s info --print-runtime-info --verbose=' % get_cmd('') |
48 out = self.run_command(cmd) |
53 out = self.run_command(cmd) |
95 CONF_FILE = os.path.join(ROOT_PATH, 'testdata', 'log_config.ini') |
100 CONF_FILE = os.path.join(ROOT_PATH, 'testdata', 'log_config.ini') |
96 cmd = '%s --log-config "%s"' % (get_cmd('info'), CONF_FILE) |
101 cmd = '%s --log-config "%s"' % (get_cmd('info'), CONF_FILE) |
97 out = self.run_command(cmd) |
102 out = self.run_command(cmd) |
98 self.assertTrue("Level:DEBUG, Logger:cone, Message:sys.path contents:" in out, out) |
103 self.assertTrue("Level:DEBUG, Logger:cone, Message:sys.path contents:" in out, out) |
99 |
104 |
|
105 def test_custom_log_config_with_escaping(self): |
|
106 CONF_FILE = os.path.join(ROOT_PATH, 'testdata', 'log_config.ini') |
|
107 LOG_FILE = os.path.join(ROOT_PATH, 'testdata', "log\\x\\cone.log") |
|
108 cmd = '%s --log-config "%s" --log-file "%s"' % (get_cmd('info'), CONF_FILE, LOG_FILE) |
|
109 out = self.run_command(cmd) |
|
110 self.assertTrue("Level:DEBUG, Logger:cone, Message:sys.path contents:" in out, out) |
|
111 |
|
112 |
100 if __name__ == '__main__': |
113 if __name__ == '__main__': |
101 unittest.main() |
114 unittest.main() |
102 |
115 |