Index: scripts/slave/unittests/recipes_test.py |
diff --git a/scripts/slave/unittests/recipes_test.py b/scripts/slave/unittests/recipes_test.py |
index cdb6296473a4955b389c2d233ec8ce9e8913de6a..9e1b9fc7998af6a5850e56cd4462b24a83cb2650 100755 |
--- a/scripts/slave/unittests/recipes_test.py |
+++ b/scripts/slave/unittests/recipes_test.py |
@@ -64,6 +64,7 @@ BASE_DIRS = { |
} |
# TODO(iannucci): Check for duplicate recipe names when we have more than one |
# base_dir |
+RECIPE_MODULES = [os.path.join(x, 'recipe_modules') for x in BASE_DIRS.values()] |
COVERAGE = coverage.coverage( |
include=([os.path.join(x, 'recipes', '*') for x in BASE_DIRS.values()]+ |
@@ -84,60 +85,6 @@ with cover(): |
from slave import annotated_run |
from slave import recipe_api |
-class TestAPI(object): |
- @staticmethod |
- def properties_generic(**kwargs): |
- """ |
- Merge kwargs into a typical buildbot properties blob, and return the blob. |
- """ |
- ret = { |
- 'blamelist': 'cool_dev1337@chromium.org,hax@chromium.org', |
- 'blamelist_real': ['cool_dev1337@chromium.org', 'hax@chromium.org'], |
- 'buildername': 'TestBuilder', |
- 'buildnumber': 571, |
- 'mastername': 'chromium.testing.master', |
- 'slavename': 'TestSlavename', |
- 'workdir': '/path/to/workdir/TestSlavename', |
- } |
- ret.update(kwargs) |
- return ret |
- |
- @staticmethod |
- def properties_scheduled(**kwargs): |
- """ |
- Merge kwargs into a typical buildbot properties blob for a job fired off |
- by a chrome/trunk svn scheduler, and return the blob. |
- """ |
- ret = TestAPI.properties_generic( |
- branch='TestBranch', |
- project='', |
- repository='svn://svn-mirror.golo.chromium.org/chrome/trunk', |
- revision='204787', |
- ) |
- ret.update(kwargs) |
- return ret |
- |
- @staticmethod |
- def properties_tryserver(**kwargs): |
- """ |
- Merge kwargs into a typical buildbot properties blob for a job fired off |
- by a rietveld tryjob on the tryserver, and return the blob. |
- """ |
- ret = TestAPI.properties_generic( |
- branch='', |
- issue=12853011, |
- patchset=1, |
- project='chrome', |
- repository='', |
- requester='commit-bot@chromium.org', |
- revision='HEAD', |
- rietveld='https://chromiumcodereview.appspot.com', |
- root='src', |
- ) |
- ret.update(kwargs) |
- return ret |
- |
- |
def expected_for(recipe_path, test_name): |
root, name = os.path.split(recipe_path) |
name = os.path.splitext(name)[0] |
@@ -152,7 +99,8 @@ def exec_test_file(recipe_path): |
with cover(): |
execfile(recipe_path, gvars) |
try: |
- gen = gvars['GenTests'](TestAPI()) |
+ test_api = recipe_api.CreateTestApi(RECIPE_MODULES, gvars['DEPS']) |
+ gen = gvars['GenTests'](test_api) |
except Exception, e: |
print "Caught exception while processing %s: %s" % (recipe_path, e) |
raise |