OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 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 """Unittests for test_dispatcher.py.""" | 6 """Unittests for test_dispatcher.py.""" |
7 | 7 |
8 # pylint: disable=no-self-use | 8 # pylint: disable=no-self-use |
9 # pylint: disable=protected-access | 9 # pylint: disable=protected-access |
10 | 10 |
11 import unittest | 11 import unittest |
12 | 12 |
13 from devil.android import device_utils | |
14 from devil.android.sdk import adb_wrapper | |
15 from devil.constants import exit_codes | |
16 from devil.utils import watchdog_timer | |
17 from pylib.base import base_test_result | 13 from pylib.base import base_test_result |
18 from pylib.base import test_collection | 14 from pylib.base import test_collection |
19 from pylib.base import test_dispatcher | 15 from pylib.base import test_dispatcher |
20 from pylib.constants import host_paths | 16 from pylib.constants import host_paths |
21 | 17 |
| 18 with host_paths.SysPath(host_paths.DEVIL_PATH): |
| 19 from devil.android import device_utils |
| 20 from devil.android.sdk import adb_wrapper |
| 21 from devil.constants import exit_codes |
| 22 from devil.utils import watchdog_timer |
| 23 |
22 with host_paths.SysPath(host_paths.PYMOCK_PATH): | 24 with host_paths.SysPath(host_paths.PYMOCK_PATH): |
23 import mock # pylint: disable=import-error | 25 import mock # pylint: disable=import-error |
24 | 26 |
25 | 27 |
26 class TestException(Exception): | 28 class TestException(Exception): |
27 pass | 29 pass |
28 | 30 |
29 | 31 |
30 def _MockDevice(serial): | 32 def _MockDevice(serial): |
31 d = mock.MagicMock(spec=device_utils.DeviceUtils) | 33 d = mock.MagicMock(spec=device_utils.DeviceUtils) |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 232 |
231 def testNoTests(self): | 233 def testNoTests(self): |
232 results, exit_code = test_dispatcher.RunTests( | 234 results, exit_code = test_dispatcher.RunTests( |
233 [], MockRunner, [_MockDevice('0'), _MockDevice('1')], shard=False) | 235 [], MockRunner, [_MockDevice('0'), _MockDevice('1')], shard=False) |
234 self.assertEqual(len(results.GetAll()), 0) | 236 self.assertEqual(len(results.GetAll()), 0) |
235 self.assertEqual(exit_code, exit_codes.ERROR) | 237 self.assertEqual(exit_code, exit_codes.ERROR) |
236 | 238 |
237 | 239 |
238 if __name__ == '__main__': | 240 if __name__ == '__main__': |
239 unittest.main() | 241 unittest.main() |
OLD | NEW |