Home | History | Annotate | Download | only in isolate
      1 # Copyright 2014 The Chromium Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 
      6 # TODO(borenet): This module was copied from build.git and heavily modified to
      7 # remove dependencies on other modules in build.git.  It belongs in a different
      8 # repo. Remove this once it has been moved.
      9 
     10 
     11 from recipe_engine import recipe_test_api
     12 
     13 class IsolateTestApi(recipe_test_api.RecipeTestApi):
     14   def output_json(self, targets=None, missing=None):
     15     """Mocked output of 'find_isolated_tests' and 'isolate_tests' steps.
     16 
     17     Deterministically synthesizes json.output test data for the given targets.
     18     If |targets| is None, will emit test data with some dummy targets instead,
     19     emulating find_isolated_tests.py finding some files.
     20 
     21     If |missing| is given it's a subset of |targets| that wasn't isolated in
     22     'isolate_tests' due to some error.
     23     """
     24     missing = missing or ()
     25     if targets is None:
     26       targets = ['dummy_target_1', 'dummy_target_2']
     27     return self.m.json.output({
     28       target: None if target in missing else '[dummy hash for %s]' % target
     29       for target in targets
     30     })
     31