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

Side by Side Diff: infra/libs/service_utils/test/outer_loop_test.py

Issue 2213143002: Add infra_libs as a bootstrap dependency. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Removed the ugly import hack Created 4 years, 4 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 unified diff | Download patch
OLDNEW
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 import time 5 import time
6 6
7 from testing_support import auto_stub 7 from testing_support import auto_stub
8 8
9 from infra.libs.service_utils import outer_loop 9 from infra.libs.service_utils import outer_loop
10 10
11 from infra_libs.ts_mon.common import interface 11 from infra_libs.ts_mon.common import interface
12 from infra_libs.ts_mon.common.test import stubs
13 12
14 13
15 class TestOuterLoop(auto_stub.TestCase): 14 class TestOuterLoop(auto_stub.TestCase):
16 15
17 class MyTime(): 16 class MyTime():
18 def __init__(self): 17 def __init__(self):
19 self.sleeps = [] 18 self.sleeps = []
20 self.now = 0 19 self.now = 0
21 def sleep(self, t): 20 def sleep(self, t):
22 self.sleeps.append(t) 21 self.sleeps.append(t)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 if t == 'err': 84 if t == 'err':
86 raise Exception('Horrible error') 85 raise Exception('Horrible error')
87 if t == 'false': 86 if t == 'false':
88 return False 87 return False
89 return True 88 return True
90 ret = outer_loop.loop(task, sleep_timeout=lambda: 1, max_errors=3, 89 ret = outer_loop.loop(task, sleep_timeout=lambda: 1, max_errors=3,
91 time_mod=self.time_mod) 90 time_mod=self.time_mod)
92 self.assertEqual(outer_loop.LoopResults(False, 5), ret) 91 self.assertEqual(outer_loop.LoopResults(False, 5), ret)
93 self.assertEqual(['skipped'], tasks) 92 self.assertEqual(['skipped'], tasks)
94 self.assertEqual([1, 1, 1, 1, 1, 1], self.time_mod.sleeps) 93 self.assertEqual([1, 1, 1, 1, 1, 1], self.time_mod.sleeps)
OLDNEW
« bootstrap/deps.pyl ('K') | « bootstrap/deps.pyl ('k') | infra_libs/.coveragerc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698