OLD | NEW |
---|---|
1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Encapsulates running tests defined in tests.py. | 6 """Encapsulates running tests defined in tests.py. |
7 | 7 |
8 Running this script requires passing --config-path with a path to a config file | 8 Running this script requires passing --config-path with a path to a config file |
9 of the following structure: | 9 of the following structure: |
10 | 10 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 try: | 122 try: |
123 with stopit.ThreadingTimeout(100) as timeout: | 123 with stopit.ThreadingTimeout(100) as timeout: |
124 logger.log(SCRIPT_DEBUG, | 124 logger.log(SCRIPT_DEBUG, |
125 "Run test with parameters: %s %s %s %s %s %s", | 125 "Run test with parameters: %s %s %s %s %s %s", |
126 config.chrome_path, config.chromedriver_path, | 126 config.chrome_path, config.chromedriver_path, |
127 profile_path, config.passwords_path, | 127 profile_path, config.passwords_path, |
128 website, test_case) | 128 website, test_case) |
129 result = tests.RunTest(config.chrome_path, config.chromedriver_path, | 129 result = tests.RunTest(config.chrome_path, config.chromedriver_path, |
130 profile_path, config.passwords_path, | 130 profile_path, config.passwords_path, |
131 website, test_case)[0] | 131 website, test_case)[0] |
132 if timeout != timeout.EXECUTED: | 132 if timeout.state != timeout.EXECUTED: |
133 result = (website, test_case, False, "Timeout") | 133 result = (website, test_case, False, |
134 "Get %s as timeout state instead of expected %s" % | |
vabr (Chromium)
2015/05/18 16:28:27
grammar: Get -> Got
melandory
2015/05/19 08:07:25
Done.
| |
135 (timeout.state, timeout.EXECUTED)) | |
vabr (Chromium)
2015/05/18 16:28:27
Printing the EXECUTED constant looks a bit strange
melandory
2015/05/19 08:07:25
Done.
| |
134 _, _, success, _ = result | 136 _, _, success, _ = result |
135 if success: | 137 if success: |
136 return result | 138 return result |
137 except Exception as e: | 139 except Exception as e: |
138 result = (website, test_case, False, e) | 140 result = (website, test_case, False, e) |
139 return result | 141 return result |
140 | 142 |
141 | 143 |
142 def RunTests(config_path): | 144 def RunTests(config_path): |
143 """Runs automated tests. | 145 """Runs automated tests. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 def main(): | 177 def main(): |
176 parser = argparse.ArgumentParser() | 178 parser = argparse.ArgumentParser() |
177 parser.add_argument("config_path", metavar="N", | 179 parser.add_argument("config_path", metavar="N", |
178 help="Path to the config.ini file.") | 180 help="Path to the config.ini file.") |
179 args = parser.parse_args() | 181 args = parser.parse_args() |
180 RunTests(args.config_path) | 182 RunTests(args.config_path) |
181 | 183 |
182 | 184 |
183 if __name__ == "__main__": | 185 if __name__ == "__main__": |
184 main() | 186 main() |
OLD | NEW |