OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """PyAuto: Python Interface to Chromium's Automation Proxy. | 6 """PyAuto: Python Interface to Chromium's Automation Proxy. |
7 | 7 |
8 PyAuto uses swig to expose Automation Proxy interfaces to Python. | 8 PyAuto uses swig to expose Automation Proxy interfaces to Python. |
9 For complete documentation on the functionality available, | 9 For complete documentation on the functionality available, |
10 run pydoc on this file. | 10 run pydoc on this file. |
(...skipping 5020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5031 test_names = pyauto_utils.Shard(test_names, shard_index, num_shards) | 5031 test_names = pyauto_utils.Shard(test_names, shard_index, num_shards) |
5032 | 5032 |
5033 test_names *= self._options.repeat | 5033 test_names *= self._options.repeat |
5034 logging.debug("Loading %d tests from %s", len(test_names), test_names) | 5034 logging.debug("Loading %d tests from %s", len(test_names), test_names) |
5035 if self._options.list_tests: # List tests and exit | 5035 if self._options.list_tests: # List tests and exit |
5036 for name in test_names: | 5036 for name in test_names: |
5037 print name | 5037 print name |
5038 sys.exit(0) | 5038 sys.exit(0) |
5039 pyauto_suite = PyUITestSuite(suite_args) | 5039 pyauto_suite = PyUITestSuite(suite_args) |
5040 loaded_tests = unittest.defaultTestLoader.loadTestsFromNames(test_names) | 5040 loaded_tests = unittest.defaultTestLoader.loadTestsFromNames(test_names) |
5041 pyauto_suite = PyUITestSuite(suite_args) | |
5042 pyauto_suite.addTests(loaded_tests) | 5041 pyauto_suite.addTests(loaded_tests) |
5043 verbosity = 1 | 5042 verbosity = 1 |
5044 if self._options.verbose: | 5043 if self._options.verbose: |
5045 verbosity = 2 | 5044 verbosity = 2 |
5046 result = PyAutoTextTestRunner(verbosity=verbosity).run(pyauto_suite) | 5045 result = PyAutoTextTestRunner(verbosity=verbosity).run(pyauto_suite) |
5047 del loaded_tests # Need to destroy test cases before the suite | 5046 del loaded_tests # Need to destroy test cases before the suite |
5048 del pyauto_suite | 5047 del pyauto_suite |
5049 successful = result.wasSuccessful() | 5048 successful = result.wasSuccessful() |
5050 if not successful: | 5049 if not successful: |
5051 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) | 5050 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) |
5052 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ | 5051 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ |
5053 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) | 5052 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) |
5054 sys.exit(not successful) | 5053 sys.exit(not successful) |
5055 | 5054 |
5056 | 5055 |
5057 if __name__ == '__main__': | 5056 if __name__ == '__main__': |
5058 Main() | 5057 Main() |
OLD | NEW |