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

Unified Diff: recipe_engine/loader.py

Issue 2864803003: Minor loader improvements. (Closed)
Patch Set: alphabetize Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« 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