| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 import os | 5 import os |
| 6 import sys | 6 import sys |
| 7 import unittest | 7 import unittest |
| 8 | 8 |
| 9 # TODO(robertocn): Use abspath for these, to prevent relative path errors. | 9 # TODO(robertocn): Use abspath for these, to prevent relative path errors. |
| 10 _RECIPE_MODULES_DIR = os.path.join(os.path.dirname(__file__), os.path.pardir) | |
| 11 # For the importing of mock. | 10 # For the importing of mock. |
| 12 _ROOT_DIR = os.path.join(os.path.dirname(__file__), os.path.pardir, | 11 _ROOT_DIR = os.path.join(os.path.dirname(__file__), os.path.pardir, |
| 13 os.path.pardir, os.path.pardir, os.path.pardir) | 12 os.path.pardir, os.path.pardir, os.path.pardir) |
| 14 | 13 |
| 15 sys.path.append(_RECIPE_MODULES_DIR) | |
| 16 sys.path.append(os.path.join(_ROOT_DIR, 'third_party', 'mock-1.0.1')) | 14 sys.path.append(os.path.join(_ROOT_DIR, 'third_party', 'mock-1.0.1')) |
| 17 | 15 |
| 18 import mock | 16 import mock |
| 19 | 17 |
| 20 from auto_bisect.bisector import Bisector | 18 from .bisector import Bisector |
| 21 | 19 |
| 22 | 20 |
| 23 class MockRevisionClass(object): # pragma: no cover | 21 class MockRevisionClass(object): # pragma: no cover |
| 24 | 22 |
| 25 def __init__(self, rev_string, bisector): | 23 def __init__(self, rev_string, bisector): |
| 26 self.commit_pos = int(rev_string) | 24 self.commit_pos = int(rev_string) |
| 27 self.revision_string = rev_string | 25 self.revision_string = rev_string |
| 28 self.bisector = bisector | 26 self.bisector = bisector |
| 29 self.previous_revision = None | 27 self.previous_revision = None |
| 30 self.next_revision = None | 28 self.next_revision = None |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 self.assertTrue(self.called_abort) | 249 self.assertTrue(self.called_abort) |
| 252 | 250 |
| 253 # Verifying the side effects of updating the candidate range | 251 # Verifying the side effects of updating the candidate range |
| 254 self.assertEqual(r[2], bisector.lkgr) | 252 self.assertEqual(r[2], bisector.lkgr) |
| 255 self.assertEqual(r[3], bisector.fkbr) | 253 self.assertEqual(r[3], bisector.fkbr) |
| 256 | 254 |
| 257 | 255 |
| 258 # TODO(robertocn): Add test for bisector.check_bisect_finished. | 256 # TODO(robertocn): Add test for bisector.check_bisect_finished. |
| 259 if __name__ == '__main__': | 257 if __name__ == '__main__': |
| 260 unittest.main() # pragma: no cover | 258 unittest.main() # pragma: no cover |
| OLD | NEW |