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

Unified Diff: appengine/findit/handlers/test/build_failure_test.py

Issue 2425853005: [Findit] Modify Findit API to return more information to Sheriff-O-Matic. (Closed)
Patch Set: rebase Created 4 years, 2 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 | « appengine/findit/handlers/build_failure.py ('k') | appengine/findit/model/test/wf_suspected_cl_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/handlers/test/build_failure_test.py
diff --git a/appengine/findit/handlers/test/build_failure_test.py b/appengine/findit/handlers/test/build_failure_test.py
index 14fa659f651800e145f97acc998fb17829852e2d..932857631d632fd68eb0c0a6f76f8469f0bf1cfb 100644
--- a/appengine/findit/handlers/test/build_failure_test.py
+++ b/appengine/findit/handlers/test/build_failure_test.py
@@ -24,6 +24,7 @@ from model.wf_suspected_cl import WfSuspectedCL
from model.wf_try_job import WfTryJob
from waterfall import build_util
from waterfall import buildbot
+from waterfall import build_util
from waterfall.test import wf_testcase
# Root directory appengine/findit.
@@ -782,6 +783,9 @@ class BuildFailureTest(wf_testcase.WaterfallTestCase):
analysis, data)
self.assertEqual(expected_data, data)
+ def _PercentFormat(self, float_number):
+ return '%d%%' % (round(float_number * 100))
+
def testGetTryJobResultForCompileFailure(self):
analysis = WfAnalysis.Create('m', 'b', 123)
analysis.result = {
@@ -855,7 +859,7 @@ class BuildFailureTest(wf_testcase.WaterfallTestCase):
'commit_position': 122,
'url': None,
'status': suspected_cl_status.CORRECT,
- 'confidence': build_failure._PercentFormat(
+ 'confidence': self._PercentFormat(
self.cl_confidences.compile_heuristic_try_job.confidence)
}
]
@@ -910,120 +914,3 @@ class BuildFailureTest(wf_testcase.WaterfallTestCase):
master_name, builder_name, build_number, analysis)
self.assertEqual(
expected_suspected_cls, suspected_cls)
-
- def testGetConfidenceScoreTestHeuristic(self):
- build = {
- 'failure_type': failure_type.TEST,
- 'failures': None,
- 'status': suspected_cl_status.CORRECT,
- 'approaches': [analysis_approach_type.HEURISTIC],
- 'top_score': 5
- }
-
- self.assertEqual(
- build_failure._PercentFormat(
- self.cl_confidences.test_heuristic[1].confidence),
- build_failure._GetConfidenceScore(self.cl_confidences, build))
-
- def testGetConfidenceScoreCompileHeuristic(self):
- build = {
- 'failure_type': failure_type.COMPILE,
- 'failures': None,
- 'status': suspected_cl_status.CORRECT,
- 'approaches': [analysis_approach_type.HEURISTIC],
- 'top_score': 4
- }
-
- self.assertEqual(
- build_failure._PercentFormat(
- self.cl_confidences.compile_heuristic[1].confidence),
- build_failure._GetConfidenceScore(self.cl_confidences, build))
-
- def testGetConfidenceScoreTestTryJob(self):
- build = {
- 'failure_type': failure_type.TEST,
- 'failures': None,
- 'status': suspected_cl_status.CORRECT,
- 'approaches': [analysis_approach_type.TRY_JOB],
- 'top_score': 5
- }
-
- self.assertEqual(
- build_failure._PercentFormat(
- self.cl_confidences.test_try_job.confidence),
- build_failure._GetConfidenceScore(self.cl_confidences, build))
-
- def testGetConfidenceScoreCompileTryJob(self):
- build = {
- 'failure_type': failure_type.COMPILE,
- 'failures': None,
- 'status': suspected_cl_status.CORRECT,
- 'approaches': [analysis_approach_type.TRY_JOB],
- 'top_score': 5
- }
-
- self.assertEqual(
- build_failure._PercentFormat(
- self.cl_confidences.test_try_job.confidence),
- build_failure._GetConfidenceScore(self.cl_confidences, build))
-
- def testGetConfidenceScoreTestHeuristicTryJob(self):
- build = {
- 'failure_type': failure_type.TEST,
- 'failures': None,
- 'status': suspected_cl_status.CORRECT,
- 'approaches': [analysis_approach_type.HEURISTIC,
- analysis_approach_type.TRY_JOB],
- 'top_score': 5
- }
-
- self.assertEqual(
- build_failure._PercentFormat(
- self.cl_confidences.test_heuristic_try_job.confidence),
- build_failure._GetConfidenceScore(self.cl_confidences, build))
-
- def testGetConfidenceScoreNone(self):
- self.assertIsNone(build_failure._GetConfidenceScore(None, None))
-
- def testGetConfidenceScoreUnexpected(self):
- build = {
- 'failure_type': failure_type.COMPILE,
- 'failures': None,
- 'status': suspected_cl_status.CORRECT,
- 'approaches': [analysis_approach_type.HEURISTIC],
- 'top_score': 2
- }
-
- self.assertIsNone(build_failure._GetConfidenceScore(
- self.cl_confidences, build))
-
- def testGetConfidenceScoreCompileNone(self):
- build = {
- 'failure_type': failure_type.COMPILE,
- 'approaches': []
- }
- self.assertIsNone(build_failure._GetConfidenceScore(
- self.cl_confidences, build))
-
- def testGetConfidenceScoreUnexpectedTest(self):
- build = {
- 'failure_type': failure_type.TEST,
- 'failures': None,
- 'status': suspected_cl_status.CORRECT,
- 'approaches': [analysis_approach_type.HEURISTIC],
- 'top_score': 2
- }
-
- self.assertIsNone(build_failure._GetConfidenceScore(
- self.cl_confidences, build))
-
- def testGetConfidenceScoreTestNone(self):
- build = {
- 'failure_type': failure_type.TEST,
- 'approaches': []
- }
- self.assertIsNone(build_failure._GetConfidenceScore(
- self.cl_confidences, build))
-
- def testPercentFormatNone(self):
- self.assertIsNone(build_failure._PercentFormat(None))
« no previous file with comments | « appengine/findit/handlers/build_failure.py ('k') | appengine/findit/model/test/wf_suspected_cl_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698