| OLD | NEW |
| 1 # Copyright 2014 Google Inc. All rights reserved. | 1 # Copyright 2014 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Licensed under the Apache License, Version 2.0 (the "License"); | 3 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 # you may not use this file except in compliance with the License. | 4 # you may not use this file except in compliance with the License. |
| 5 # You may obtain a copy of the License at | 5 # You may obtain a copy of the License at |
| 6 # | 6 # |
| 7 # http://www.apache.org/licenses/LICENSE-2.0 | 7 # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 # | 8 # |
| 9 # Unless required by applicable law or agreed to in writing, software | 9 # Unless required by applicable law or agreed to in writing, software |
| 10 # distributed under the License is distributed on an "AS IS" BASIS, | 10 # distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 add_tests(loader.discover(name, suffix, top_level_dir)) | 400 add_tests(loader.discover(name, suffix, top_level_dir)) |
| 401 else: | 401 else: |
| 402 possible_dir = name.replace('.', h.sep) | 402 possible_dir = name.replace('.', h.sep) |
| 403 if h.isdir(top_level_dir, possible_dir): | 403 if h.isdir(top_level_dir, possible_dir): |
| 404 for suffix in suffixes: | 404 for suffix in suffixes: |
| 405 path = h.join(top_level_dir, possible_dir) | 405 path = h.join(top_level_dir, possible_dir) |
| 406 suite = loader.discover(path, suffix, top_level_dir) | 406 suite = loader.discover(path, suffix, top_level_dir) |
| 407 add_tests(suite) | 407 add_tests(suite) |
| 408 else: | 408 else: |
| 409 add_tests(loader.loadTestsFromName(name)) | 409 add_tests(loader.loadTestsFromName(name)) |
| 410 if hasattr(loader, 'errors') and loader.errors: |
| 411 # In Python3's version of unittest, loader failures get converted |
| 412 # into failed test cases, rather than raising exceptions. However, |
| 413 # the errors also get recorded so you can err out immediately. |
| 414 raise ImportError(loader.errors) |
| 410 | 415 |
| 411 def _run_tests(self, result_set, test_set): | 416 def _run_tests(self, result_set, test_set): |
| 412 h = self.host | 417 h = self.host |
| 413 if not test_set.parallel_tests and not test_set.isolated_tests: | 418 if not test_set.parallel_tests and not test_set.isolated_tests: |
| 414 self.print_('No tests to run.') | 419 self.print_('No tests to run.') |
| 415 return 1, None | 420 return 1, None |
| 416 | 421 |
| 417 all_tests = [ti.name for ti in | 422 all_tests = [ti.name for ti in |
| 418 _sort_inputs(test_set.parallel_tests + | 423 _sort_inputs(test_set.parallel_tests + |
| 419 test_set.isolated_tests + | 424 test_set.isolated_tests + |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 return new_suite | 943 return new_suite |
| 939 | 944 |
| 940 | 945 |
| 941 def _sort_inputs(inps): | 946 def _sort_inputs(inps): |
| 942 return sorted(inps, key=lambda inp: inp.name) | 947 return sorted(inps, key=lambda inp: inp.name) |
| 943 | 948 |
| 944 | 949 |
| 945 if __name__ == '__main__': # pragma: no cover | 950 if __name__ == '__main__': # pragma: no cover |
| 946 sys.modules['__main__'].__file__ = path_to_file | 951 sys.modules['__main__'].__file__ = path_to_file |
| 947 sys.exit(main(win_multiprocessing=WinMultiprocessing.importable)) | 952 sys.exit(main(win_multiprocessing=WinMultiprocessing.importable)) |
| OLD | NEW |