OLD | NEW |
1 # Copyright (C) 2012 Google, Inc. | 1 # Copyright (C) 2012 Google, Inc. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions | 4 # modification, are permitted provided that the following conditions |
5 # are met: | 5 # are met: |
6 # 1. Redistributions of source code must retain the above copyright | 6 # 1. Redistributions of source code must retain the above copyright |
7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
8 # 2. Redistributions in binary form must reproduce the above copyright | 8 # 2. Redistributions in binary form must reproduce the above copyright |
9 # notice, this list of conditions and the following disclaimer in the | 9 # notice, this list of conditions and the following disclaimer in the |
10 # documentation and/or other materials provided with the distribution. | 10 # documentation and/or other materials provided with the distribution. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 if errors: | 65 if errors: |
66 self.errors.append((test_name, errors)) | 66 self.errors.append((test_name, errors)) |
67 self.printer.print_finished_test(source, test_name, delay, failures, err
ors) | 67 self.printer.print_finished_test(source, test_name, delay, failures, err
ors) |
68 | 68 |
69 | 69 |
70 class _Worker(object): | 70 class _Worker(object): |
71 def __init__(self, caller, loader, webkit_finder): | 71 def __init__(self, caller, loader, webkit_finder): |
72 self._caller = caller | 72 self._caller = caller |
73 self._loader = loader | 73 self._loader = loader |
74 | 74 |
75 # FIXME: unittest2 and coverage need to be in sys.path for their interna
l imports to work. | 75 # FIXME: coverage needs to be in sys.path for its internal imports to wo
rk. |
76 thirdparty_path = webkit_finder.path_from_webkit_base('Tools', 'Scripts'
, 'webkitpy', 'thirdparty') | 76 thirdparty_path = webkit_finder.path_from_webkit_base('Tools', 'Scripts'
, 'webkitpy', 'thirdparty') |
77 if not thirdparty_path in sys.path: | 77 if not thirdparty_path in sys.path: |
78 sys.path.append(thirdparty_path) | 78 sys.path.append(thirdparty_path) |
79 | 79 |
80 | 80 |
81 def handle(self, message_name, source, test_name): | 81 def handle(self, message_name, source, test_name): |
82 assert message_name == 'test' | 82 assert message_name == 'test' |
83 result = unittest.TestResult() | 83 result = unittest.TestResult() |
84 start = time.time() | 84 start = time.time() |
85 self._caller.post('started_test', test_name) | 85 self._caller.post('started_test', test_name) |
86 | 86 |
87 # We will need to rework this if a test_name results in multiple tests. | 87 # We will need to rework this if a test_name results in multiple tests. |
88 self._loader.loadTestsFromName(test_name, None).run(result) | 88 self._loader.loadTestsFromName(test_name, None).run(result) |
89 self._caller.post('finished_test', test_name, time.time() - start, | 89 self._caller.post('finished_test', test_name, time.time() - start, |
90 [failure[1] for failure in result.failures], [error[1] for error in
result.errors]) | 90 [failure[1] for failure in result.failures], [error[1] for error in
result.errors]) |
OLD | NEW |