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: recipe_modules/infra_paths/api.py

Issue 1917093004: depot_tools: only add mock infra_paths when test data is enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 from recipe_engine import recipe_api 5 from recipe_engine import recipe_api
6 from recipe_engine.config_types import Path, NamedBasePath 6 from recipe_engine.config_types import Path, NamedBasePath
7 7
8 8
9 class InfraPathsApi(recipe_api.RecipeApi): 9 class InfraPathsApi(recipe_api.RecipeApi):
10 def get_config_defaults(self): 10 def get_config_defaults(self):
(...skipping 11 matching lines...) Expand all
22 if self._config_set: 22 if self._config_set:
23 return 23 return
24 self._config_set = True 24 self._config_set = True
25 25
26 path_config = self.m.properties.get('path_config') 26 path_config = self.m.properties.get('path_config')
27 if path_config in ('kitchen',): 27 if path_config in ('kitchen',):
28 self.set_config(path_config) 28 self.set_config(path_config)
29 else: 29 else:
30 self.set_config('buildbot') 30 self.set_config('buildbot')
31 31
32 for path in self._test_data.get('exists', []): 32 if self._test_data.enabled:
33 assert isinstance(path.base, NamedBasePath) 33 for path in self._test_data.get('exists', []):
34 self.m.path.mock_add_paths(self[path.base.name].join(*path.pieces)) 34 assert isinstance(path.base, NamedBasePath)
35 self.m.path.mock_add_paths(self[path.base.name].join(*path.pieces))
35 36
36 def __getitem__(self, name): 37 def __getitem__(self, name):
37 self._lazy_set_config() 38 self._lazy_set_config()
38 return self.c.paths[name] 39 return self.c.paths[name]
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698