OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Unit tests for the contents of parallelizer.py.""" | 5 """Unit tests for the contents of parallelizer.py.""" |
6 | 6 |
7 # pylint: disable=W0212 | 7 # pylint: disable=W0212 |
8 # pylint: disable=W0613 | 8 # pylint: disable=W0613 |
9 | 9 |
10 import os | 10 import os |
11 import tempfile | 11 import tempfile |
12 import time | 12 import time |
13 import unittest | 13 import unittest |
14 | 14 |
15 from pylib.utils import parallelizer | 15 from devil.utils import parallelizer |
16 | 16 |
17 | 17 |
18 class ParallelizerTestObject(object): | 18 class ParallelizerTestObject(object): |
19 """Class used to test parallelizer.Parallelizer.""" | 19 """Class used to test parallelizer.Parallelizer.""" |
20 | 20 |
21 parallel = parallelizer.Parallelizer | 21 parallel = parallelizer.Parallelizer |
22 | 22 |
23 def __init__(self, thing, completion_file_name=None): | 23 def __init__(self, thing, completion_file_name=None): |
24 self._thing = thing | 24 self._thing = thing |
25 self._completion_file_name = completion_file_name | 25 self._completion_file_name = completion_file_name |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 157 |
158 def testGetItem(self): | 158 def testGetItem(self): |
159 devices = [ParallelizerTestObject(range(i, i+10)) for i in xrange(0, 10)] | 159 devices = [ParallelizerTestObject(range(i, i+10)) for i in xrange(0, 10)] |
160 results = ParallelizerTestObject.parallel(devices)[9].pGet(1) | 160 results = ParallelizerTestObject.parallel(devices)[9].pGet(1) |
161 self.assertEquals(range(9, 19), results) | 161 self.assertEquals(range(9, 19), results) |
162 | 162 |
163 | 163 |
164 if __name__ == '__main__': | 164 if __name__ == '__main__': |
165 unittest.main(verbosity=2) | 165 unittest.main(verbosity=2) |
166 | 166 |
OLD | NEW |