Chromium Code Reviews| Index: recipe_engine/loader.py |
| diff --git a/recipe_engine/loader.py b/recipe_engine/loader.py |
| index 029bcb387fd0cc450b881463363e82fb7f8d9d25..b54dd90b381335883e2d4dc807483fed83519b52 100644 |
| --- a/recipe_engine/loader.py |
| +++ b/recipe_engine/loader.py |
| @@ -14,7 +14,7 @@ from .config import ConfigContext, ConfigGroupSchema |
| from .config_types import Path, ModuleBasePath, PackageRepoBasePath |
| from .config_types import RecipeScriptBasePath |
| from .config_types import RECIPE_MODULE_PREFIX |
| -from .recipe_api import RecipeApiPlain, RecipeScriptApi |
| +from .recipe_api import RecipeApi, RecipeApiPlain, RecipeScriptApi |
| from .recipe_api import _UnresolvedRequirement |
| from .recipe_api import BoundProperty |
| from .recipe_api import UndefinedPropertyException, PROPERTY_SENTINEL |
| @@ -106,6 +106,12 @@ class RecipeScript(object): |
| recipe_globals['LOADED_DEPS'] = universe_view.deps_from_spec( |
| recipe_globals.get('DEPS', [])) |
| + if 'RunSteps' not in recipe_globals: |
| + raise Exception('Missing or misspelled RunSteps function.') |
|
dnj
2017/05/06 02:37:14
Let's make this "MalformedRecipeError" or somethin
iannucci
2017/05/06 02:54:55
Done, added test too :)
|
| + |
| + if 'GenTests' not in recipe_globals: |
| + raise Exception('Missing or misspelled GenTests function.') |
| + |
| return cls(name, recipe_globals, universe_view.package.name, script_path) |
| @@ -454,6 +460,10 @@ def _patchup_module(name, submod, universe_view): |
| submod.API = getattr(submod, 'API', None) |
| assert hasattr(submod, 'api'), '%s is missing api.py' % (name,) |
| for v in submod.api.__dict__.itervalues(): |
| + # If the recipe has literally imported the RecipeApi, we don't wan't |
| + # to consider that to be the real RecipeApi :) |
| + if v is RecipeApiPlain or v is RecipeApi: |
| + continue |
| if inspect.isclass(v) and issubclass(v, RecipeApiPlain): |
| assert not submod.API, ( |
| '%s has more than one RecipeApi subclass: %s, %s' % ( |
| @@ -465,6 +475,10 @@ def _patchup_module(name, submod, universe_view): |
| submod.TEST_API = getattr(submod, 'TEST_API', None) |
| if hasattr(submod, 'test_api'): |
| for v in submod.test_api.__dict__.itervalues(): |
| + # If the recipe has literally imported the RecipeTestApi, we don't wan't |
| + # to consider that to be the real RecipeTestApi :) |
| + if v is RecipeTestApi: |
| + continue |
| if inspect.isclass(v) and issubclass(v, RecipeTestApi): |
| assert not submod.TEST_API, ( |
| 'More than one TestApi subclass: %s' % submod.api) |