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

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: fix nits 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
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 09c3eea6650736be567ce4613b52fe37c4bea157..d88ef561ee89611ceaa0ef3cd9806e31c27621a5 100644
--- a/appengine/findit/handlers/test/build_failure_test.py
+++ b/appengine/findit/handlers/test/build_failure_test.py
@@ -782,6 +782,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 +858,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)
}
]
@@ -909,121 +912,4 @@ class BuildFailureTest(wf_testcase.WaterfallTestCase):
suspected_cls = build_failure._GetAllSuspectedCLsAndCheckStatus(
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))
+ expected_suspected_cls, suspected_cls)

Powered by Google App Engine
This is Rietveld 408576698