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

Unified Diff: client/common_lib/test_unittest.py

Issue 6598041: Merge remote branch 'autotest-upstream/master' into merge-upstream (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 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
« no previous file with comments | « client/common_lib/test.py ('k') | client/tests/kvm/test_setup.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/common_lib/test_unittest.py
diff --git a/client/common_lib/test_unittest.py b/client/common_lib/test_unittest.py
index 9710fd07d61b017a710a96dcb896cd02336bf84e..d2218bac7fe15e8a42a4ae41f9277bcce69f70b6 100755
--- a/client/common_lib/test_unittest.py
+++ b/client/common_lib/test_unittest.py
@@ -64,13 +64,35 @@ class Test_base_test_execute(TestTestCase):
self.test.drop_caches_between_iterations.expect_call()
before_hook.expect_call(self.test)
self.test.run_once.expect_call(1, 2, arg='val')
- after_hook.expect_call(self.test)
self.test.postprocess_iteration.expect_call()
self.test.analyze_perf_constraints.expect_call([])
+ after_hook.expect_call(self.test)
self.test._call_run_once([], False, None, (1, 2), {'arg': 'val'})
self.god.check_playback()
+ def test_call_run_once_with_exception(self):
+ # setup
+ self.god.stub_function(self.test, 'drop_caches_between_iterations')
+ self.god.stub_function(self.test, 'run_once')
+ before_hook = self.god.create_mock_function('before_hook')
+ after_hook = self.god.create_mock_function('after_hook')
+ self.test.register_before_iteration_hook(before_hook)
+ self.test.register_after_iteration_hook(after_hook)
+ error = Exception('fail')
+
+ # tests the test._call_run_once implementation
+ self.test.drop_caches_between_iterations.expect_call()
+ before_hook.expect_call(self.test)
+ self.test.run_once.expect_call(1, 2, arg='val').and_raises(error)
+ after_hook.expect_call(self.test)
+ try:
+ self.test._call_run_once([], False, None, (1, 2), {'arg': 'val'})
+ except:
+ pass
+ self.god.check_playback()
+
+
def _expect_call_run_once(self):
self.test._call_run_once.expect_call((), False, None, (), {})
« no previous file with comments | « client/common_lib/test.py ('k') | client/tests/kvm/test_setup.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698