OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2017 The LUCI Authors. All rights reserved. | 2 # Copyright 2017 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 json | 6 import json |
7 import os | 7 import os |
8 import shutil | 8 import shutil |
9 import subprocess | 9 import subprocess |
10 import sys | 10 import sys |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 os.makedirs(config_dir) | 208 os.makedirs(config_dir) |
209 | 209 |
210 self._root_dir = root_dir | 210 self._root_dir = root_dir |
211 self._recipes_cfg = os.path.join(config_dir, 'recipes.cfg') | 211 self._recipes_cfg = os.path.join(config_dir, 'recipes.cfg') |
212 self._recipe_tool = os.path.join(ROOT_DIR, 'recipes.py') | 212 self._recipe_tool = os.path.join(ROOT_DIR, 'recipes.py') |
213 | 213 |
214 test_pkg = package_pb2.Package( | 214 test_pkg = package_pb2.Package( |
215 api_version=1, | 215 api_version=1, |
216 project_id='test_pkg', | 216 project_id='test_pkg', |
217 recipes_path='', | 217 recipes_path='', |
218 deps=[ | 218 deps={ |
219 package_pb2.DepSpec( | 219 'recipe_engine': package_pb2.DepSpec(url='file://'+ROOT_DIR), |
220 project_id='recipe_engine', | 220 } |
221 url='file://'+ROOT_DIR), | |
222 ], | |
223 ) | 221 ) |
224 package.ProtoFile(self._recipes_cfg).write(test_pkg) | 222 package.ProtoFile(self._recipes_cfg).write(test_pkg) |
225 | 223 |
226 self.maxDiff = None | 224 self.maxDiff = None |
227 | 225 |
228 def tearDown(self): | 226 def tearDown(self): |
229 shutil.rmtree(self._root_dir) | 227 shutil.rmtree(self._root_dir) |
230 | 228 |
231 @property | 229 @property |
232 def json_path(self): | 230 def json_path(self): |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 rw.RunStepsLines = ['pass'] | 801 rw.RunStepsLines = ['pass'] |
804 rw.GenTestsLines = ['yield api.test(%r)' % test_name] | 802 rw.GenTestsLines = ['yield api.test(%r)' % test_name] |
805 rw.add_expectation(test_name) | 803 rw.add_expectation(test_name) |
806 rw.write() | 804 rw.write() |
807 self._run_recipes('test', 'run', '--json', self.json_path) | 805 self._run_recipes('test', 'run', '--json', self.json_path) |
808 self.assertEqual(self.json_generator.get(), self.json_contents) | 806 self.assertEqual(self.json_generator.get(), self.json_contents) |
809 | 807 |
810 | 808 |
811 if __name__ == '__main__': | 809 if __name__ == '__main__': |
812 sys.exit(unittest.main()) | 810 sys.exit(unittest.main()) |
OLD | NEW |