| 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 5017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5028 print >>sys.stderr, 'Invalid sharding params: %s' % self._options.shard | 5028 print >>sys.stderr, 'Invalid sharding params: %s' % self._options.shard |
| 5029 sys.exit(1) | 5029 sys.exit(1) |
| 5030 test_names = pyauto_utils.Shard(test_names, shard_index, num_shards) | 5030 test_names = pyauto_utils.Shard(test_names, shard_index, num_shards) |
| 5031 | 5031 |
| 5032 test_names *= self._options.repeat | 5032 test_names *= self._options.repeat |
| 5033 logging.debug("Loading %d tests from %s", len(test_names), test_names) | 5033 logging.debug("Loading %d tests from %s", len(test_names), test_names) |
| 5034 if self._options.list_tests: # List tests and exit | 5034 if self._options.list_tests: # List tests and exit |
| 5035 for name in test_names: | 5035 for name in test_names: |
| 5036 print name | 5036 print name |
| 5037 sys.exit(0) | 5037 sys.exit(0) |
| 5038 pyauto_suite = PyUITestSuite(suite_args) |
| 5038 loaded_tests = unittest.defaultTestLoader.loadTestsFromNames(test_names) | 5039 loaded_tests = unittest.defaultTestLoader.loadTestsFromNames(test_names) |
| 5039 pyauto_suite = PyUITestSuite(suite_args) | |
| 5040 pyauto_suite.addTests(loaded_tests) | 5040 pyauto_suite.addTests(loaded_tests) |
| 5041 verbosity = 1 | 5041 verbosity = 1 |
| 5042 if self._options.verbose: | 5042 if self._options.verbose: |
| 5043 verbosity = 2 | 5043 verbosity = 2 |
| 5044 result = PyAutoTextTestRunner(verbosity=verbosity).run(pyauto_suite) | 5044 result = PyAutoTextTestRunner(verbosity=verbosity).run(pyauto_suite) |
| 5045 del loaded_tests # Need to destroy test cases before the suite | 5045 del loaded_tests # Need to destroy test cases before the suite |
| 5046 del pyauto_suite | 5046 del pyauto_suite |
| 5047 successful = result.wasSuccessful() | 5047 successful = result.wasSuccessful() |
| 5048 if not successful: | 5048 if not successful: |
| 5049 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) | 5049 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) |
| 5050 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ | 5050 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ |
| 5051 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) | 5051 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) |
| 5052 sys.exit(not successful) | 5052 sys.exit(not successful) |
| 5053 | 5053 |
| 5054 | 5054 |
| 5055 if __name__ == '__main__': | 5055 if __name__ == '__main__': |
| 5056 Main() | 5056 Main() |
| OLD | NEW |