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

Side by Side Diff: unittests/errors_test.py

Issue 2771723006: [recipes.cfg] ONLY support jsonpb. (Closed)
Patch Set: remove comment Created 3 years, 9 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
« no previous file with comments | « recipe_engine/unittests/fetch_test.py ('k') | unittests/package_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The LUCI Authors. All rights reserved. 2 # Copyright 2014 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 tempfile 10 import tempfile
11 import unittest 11 import unittest
12 12
13 import repo_test_util 13 import repo_test_util
14 from repo_test_util import ROOT_DIR 14 from repo_test_util import ROOT_DIR
15 15
16 16
17 class RecipeRepo(object): 17 class RecipeRepo(object):
18 def __init__(self, recipes_path=''): 18 def __init__(self, recipes_path=''):
19 self._root = tempfile.mkdtemp() 19 self._root = tempfile.mkdtemp()
20 os.makedirs(os.path.join(self._root, 'infra', 'config')) 20 os.makedirs(os.path.join(self._root, 'infra', 'config'))
21 self._recipes_cfg = os.path.join( 21 self._recipes_cfg = os.path.join(
22 self._root, 'infra', 'config', 'recipes.cfg') 22 self._root, 'infra', 'config', 'recipes.cfg')
23 with open(self._recipes_cfg, 'w') as fh: 23 with open(self._recipes_cfg, 'w') as fh:
24 fh.write(""" 24 json.dump({
25 api_version: 1 25 "api_version": 1,
26 project_id: "testproj" 26 "project_id": "testproj",
27 recipes_path: "%s" 27 "recipes_path": recipes_path,
28 deps { 28 "deps": [
29 project_id: "recipe_engine" 29 {
30 url: "%s" 30 "project_id": "recipe_engine",
31 branch: "master" 31 "url": ROOT_DIR,
32 revision: "HEAD" 32 "branch": "master",
33 } 33 "revision": "HEAD"
34 """ % (recipes_path, ROOT_DIR)) 34 }
35 ]
36 }, fh)
35 self._recipes_dir = os.path.join(self._root, 'recipes') 37 self._recipes_dir = os.path.join(self._root, 'recipes')
36 os.mkdir(self._recipes_dir) 38 os.mkdir(self._recipes_dir)
37 self._modules_dir = os.path.join(self._root, 'recipe_modules') 39 self._modules_dir = os.path.join(self._root, 'recipe_modules')
38 os.mkdir(self._modules_dir) 40 os.mkdir(self._modules_dir)
39 41
40 def make_recipe(self, recipe, contents): 42 def make_recipe(self, recipe, contents):
41 with open(os.path.join(self._recipes_dir, '%s.py' % recipe), 'w') as fh: 43 with open(os.path.join(self._recipes_dir, '%s.py' % recipe), 'w') as fh:
42 fh.write(contents) 44 fh.write(contents)
43 45
44 def make_module(self, name, init_contents, api_contents): 46 def make_module(self, name, init_contents, api_contents):
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 stdout, r'from the root of a \'testproj\' checkout') 340 stdout, r'from the root of a \'testproj\' checkout')
339 self.assertRegexpMatches( 341 self.assertRegexpMatches(
340 stdout, r'\./foo/bar/recipes\.py run .* do_nothing') 342 stdout, r'\./foo/bar/recipes\.py run .* do_nothing')
341 343
342 344
343 345
344 346
345 347
346 if __name__ == '__main__': 348 if __name__ == '__main__':
347 unittest.main() 349 unittest.main()
OLDNEW
« no previous file with comments | « recipe_engine/unittests/fetch_test.py ('k') | unittests/package_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698