Chromium Code Reviews| Index: scripts/slave/unittests/recipe_configs_test.py |
| diff --git a/scripts/slave/unittests/recipe_configs_test.py b/scripts/slave/unittests/recipe_configs_test.py |
| index 66edb7405123fb8a355477245901e2849d7421d0..82f5cbf74c4b1fa7b72a7a46fa58164c2a09ffd2 100755 |
| --- a/scripts/slave/unittests/recipe_configs_test.py |
| +++ b/scripts/slave/unittests/recipe_configs_test.py |
| @@ -43,18 +43,29 @@ def covered(fn, *args, **kwargs): |
| finally: |
| COVERAGE.stop() |
| +LOADER = recipe_loader.ModuleLoader() |
| + |
| +def load_recipe_modules(): |
| + modules = {} |
| + for modpath in recipe_loader.loop_over_recipe_modules(): |
| + # That's right, we're using the path as the local name! The local |
| + # name really could be anything unique, we don't use it. |
| + modules[modpath] = LOADER.load(recipe_loader.PathDependency( |
| + modpath, local_name=modpath, base_path=os.curdir)) |
| + return modules |
| + |
| + |
| RECIPE_MODULES = None |
| def init_recipe_modules(): |
| global RECIPE_MODULES |
| - RECIPE_MODULES = covered(recipe_loader.load_recipe_modules, |
| - recipe_util.MODULE_DIRS()) |
| + RECIPE_MODULES = covered(load_recipe_modules) |
| from slave import recipe_config # pylint: disable=F0401 |
| def evaluate_configurations(args): |
| mod_id, var_assignments, verbose = args |
| - mod = getattr(RECIPE_MODULES, mod_id) |
| + mod = RECIPE_MODULES[mod_id] |
| ctx = mod.CONFIG_CTX |
| config_name = None |
| @@ -95,8 +106,6 @@ def evaluate_configurations(args): |
| def multiprocessing_init(): |
| - init_recipe_modules() |
|
iannucci
2015/05/05 23:35:59
???????
|
| - |
| # HACK: multiprocessing doesn't work with atexit, so shim the exit functions |
| # instead. This allows us to save exactly one coverage file per subprocess. |
| # pylint: disable=W0212 |
| @@ -116,8 +125,8 @@ def multiprocessing_init(): |
| def coverage_parallel_map(fn, verbose): |
| combination_generator = ( |
| (mod_id, var_assignments, verbose) |
| - for mod_id, mod in RECIPE_MODULES.__dict__.iteritems() |
| - if mod_id[0] != '_' and mod.CONFIG_CTX |
| + for mod_id, mod in RECIPE_MODULES.iteritems() |
| + if mod.CONFIG_CTX |
| for var_assignments in imap(dict, product(*[ |
| [(key_name, val) for val in vals] |
| for key_name, vals in mod.CONFIG_CTX.VAR_TEST_MAP.iteritems() |