Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(648)

Unified Diff: scripts/slave/recipe_modules/auto_bisect/bisector_test.py

Issue 940123005: Adding ability to bisect recipe to bisect into dependency repos. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@hax
Patch Set: WIP: Early feedback request Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: scripts/slave/recipe_modules/auto_bisect/bisector_test.py
diff --git a/scripts/slave/recipe_modules/auto_bisect/bisector_test.py b/scripts/slave/recipe_modules/auto_bisect/bisector_test.py
index d8b483961674ae9516a977971b92c80a65f417ce..e4435da00e451fbc248b6a52f2bf3043a769ad1c 100644
--- a/scripts/slave/recipe_modules/auto_bisect/bisector_test.py
+++ b/scripts/slave/recipe_modules/auto_bisect/bisector_test.py
@@ -19,6 +19,10 @@ import mock
from auto_bisect.bisector import Bisector
+# Globals
+called_abort = False
+aborted_once = False
+
class BisectorTest(unittest.TestCase):
def setUp(self):
self.bisect_config = {
@@ -201,11 +205,11 @@ class BisectorTest(unittest.TestCase):
called_abort = False
aborted_once = False
- def mock_abort(s):
+ def mock_abort(_):
global aborted_once, called_abort
called_abort = True
if aborted_once:
- raise Exception('Only one abort expected')
+ raise RuntimeError('Only one abort expected')
aborted_once = True
self.MockRevisionClass.abort = None
@@ -213,7 +217,7 @@ class BisectorTest(unittest.TestCase):
with mock.patch(
'bisector_test.BisectorTest.MockRevisionClass.update_status'):
with mock.patch('bisector_test.BisectorTest.MockRevisionClass.abort',
- mock_abort) as abort_patch:
+ mock_abort):
new_bisector = Bisector(self.dummy_api, self.bisect_config,
self.MockRevisionClass)
r = new_bisector.revisions
@@ -237,7 +241,7 @@ class BisectorTest(unittest.TestCase):
try:
new_bisector.abort_unnecessary_jobs()
- except:
+ except RuntimeError:
self.fail('Expected to call abort only once')
self.assertTrue(called_abort)
qyearsley 2015/02/22 20:37:55 Would it be possible to do this without global var
RobertoCN 2015/02/24 20:01:14 Done.
@@ -245,8 +249,6 @@ class BisectorTest(unittest.TestCase):
self.assertEqual(r[2], new_bisector.lkgr)
self.assertEqual(r[3], new_bisector.fkbr)
-# TODO: Test check_bisect_finished
-
-
+# TODO(robertocn): Add test for bisector.check_bisect_finished.
if __name__ == '__main__':
unittest.main()

Powered by Google App Engine
This is Rietveld 408576698