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

Unified Diff: scripts/master/unittests/master_utils_test.py

Issue 2454643002: Fix return value of new slave-distribution function (Closed)
Patch Set: Fix Created 4 years, 2 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
« no previous file with comments | « scripts/master/master_utils.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/master/unittests/master_utils_test.py
diff --git a/scripts/master/unittests/master_utils_test.py b/scripts/master/unittests/master_utils_test.py
index bdfc0752fb9e0acdf29fdce58c88fda7ff325bea..0ea84d9104637dc7b11a0487465bfbd342538e57 100755
--- a/scripts/master/unittests/master_utils_test.py
+++ b/scripts/master/unittests/master_utils_test.py
@@ -96,11 +96,14 @@ class PreferredBuilderNextSlaveFuncTest(unittest.TestCase):
MockSlaveBuilder('s8', {'preferred_builder': None}),
]
- # Mock random.choice on function return for determinism and to check the
- # full choice range.
- f = lambda builder, slaves: (
- set([s.name for s in master_utils.PreferredBuilderNextSlaveFuncNG(
- choice=list)(builder, slaves)]))
+ def f(builder, slaves):
+ # Call original method for code coverage only.
+ master_utils.PreferredBuilderNextSlaveFuncNG()(builder, slaves)
+
+ # Mock random.choice on function return for determinism and to check the
+ # full choice range.
+ mocked_func = master_utils.PreferredBuilderNextSlaveFuncNG(choice=list)
+ return set([s.name for s in mocked_func(builder, slaves)])
self.assertEqual(set(['s1', 's4']), f(builder1, slaves))
self.assertEqual(set(['s2', 's5']), f(builder2, slaves))
« no previous file with comments | « scripts/master/master_utils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698