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

Side by Side Diff: recipe_engine/unittests/loader_test.py

Issue 2702313003: Remove unused imports and fix some other linter errors. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2015 The LUCI Authors. All rights reserved. 2 # Copyright 2015 The LUCI Authors. All rights reserved.
3 # Use of this source code is governed under the Apache License, Version 2.0 3 # Use of this source code is governed under the Apache License, Version 2.0
4 # that can be found in the LICENSE file. 4 # that can be found in the LICENSE file.
5 5
6 import os
7 import sys
8 import unittest 6 import unittest
9 7
10 import test_env 8 import test_env
11 9
12 from recipe_engine import loader, recipe_api, config 10 from recipe_engine import loader, recipe_api, config
13 import mock 11 import mock
14 12
15 13
16 class TestRecipeScript(unittest.TestCase): 14 class TestRecipeScript(unittest.TestCase):
17 def testReturnSchemaHasValidClass(self): 15 def testReturnSchemaHasValidClass(self):
18 with self.assertRaises(ValueError): 16 with self.assertRaises(ValueError):
19 script = loader.RecipeScript({'RETURN_SCHEMA': 3}, 'test_script') 17 loader.RecipeScript({'RETURN_SCHEMA': 3}, 'test_script')
20 18
21 def testRunChecksReturnType(self): 19 def testRunChecksReturnType(self):
22 sentinel = object() 20 sentinel = object()
23 mocked_return = object() 21 mocked_return = object()
24 class FakeReturn(object): 22 class FakeReturn(object):
25 def as_jsonish(_self, hidden=sentinel): 23 def as_jsonish(_self, hidden=sentinel):
26 self.assertEqual(True, hidden) 24 self.assertEqual(True, hidden)
27 25
28 return mocked_return 26 return mocked_return
29 27
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 131
134 with mock.patch( 132 with mock.patch(
135 'recipe_engine.loader._invoke_with_properties') as mocked_invoke: 133 'recipe_engine.loader._invoke_with_properties') as mocked_invoke:
136 loader.invoke_with_properties(TestClass, None, None) 134 loader.invoke_with_properties(TestClass, None, None)
137 args, _ = mocked_invoke.call_args 135 args, _ = mocked_invoke.call_args
138 self.assertTrue(['api', 'foo', 'bar'] in args) 136 self.assertTrue(['api', 'foo', 'bar'] in args)
139 137
140 138
141 if __name__ == '__main__': 139 if __name__ == '__main__':
142 unittest.main() 140 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698