def reasons_for_failure(cache, step, build, builder_name, master_url): master_name = buildbot.master_name_from_url(master_url) cache_key = os.path.join(master_name, builder_name, str(build['number']), '%s.json' % step['name']) if cache.has(cache_key): return cache.get(cache_key) splitter = reasons_splitter.splitter_for_step(step) if not splitter: return None reasons = splitter.split_step(step, build, builder_name, master_url) cache.set(cache_key, reasons) return reasons
def test_handles_step(self): name_tests = [ ('compile', reasons_splitter.CompileSplitter), ('webkit_tests', reasons_splitter.LayoutTestsSplitter), ('androidwebview_instrumentation_tests', reasons_splitter.JUnitSplitter), ('foo_tests', reasons_splitter.GTestSplitter), ('foo_test', None), ] for step_name, expected_class in name_tests: splitter = reasons_splitter.splitter_for_step({'name': step_name}) if expected_class is None: self.assertIsNone(splitter) else: self.assertEqual(splitter.__class__, expected_class)
def test_handles_step(self): name_tests = [ ("compile", reasons_splitter.CompileSplitter), ("webkit_tests", reasons_splitter.LayoutTestsSplitter), ("androidwebview_instrumentation_tests", reasons_splitter.JUnitSplitter), ("foo_tests", reasons_splitter.GTestSplitter), ("foo_test", None), ] for step_name, expected_class in name_tests: splitter = reasons_splitter.splitter_for_step({"name": step_name}) if expected_class is None: self.assertIsNone(splitter) else: self.assertEqual(splitter.__class__, expected_class)