def testFormattedResult(self): self.assertEqual(self.metric.formatted_result, '?') self.metric.result = models.MetricResult( name='PresubmitIgnoredMetric', value=1) self.assertEqual(self.metric.formatted_result, '1PR/90d') self.metric.result = models.MetricResult( name='PresubmitIgnoredMetric', value=5) self.assertEqual(self.metric.formatted_result, '5PRs/90d')
def testFormattedResult(self): self.assertEqual(self.metric.formatted_result, '?') self.metric.result = models.MetricResult( name='CherrypickIssueCountMetric', value=1) self.assertEqual(self.metric.formatted_result, '1 CP/90d') self.metric.result = models.MetricResult( name='CherrypickIssueCountMetric', value=3) self.assertEqual(self.metric.formatted_result, '3 CPs/90d')
def testFormattedResult(self): self.assertEqual(self.metric.formatted_result, '?') self.metric.result = models.MetricResult( name='ReleaseCherrypickCountMetric', value=1) self.assertEqual(self.metric.formatted_result, '1 PR/90d') self.metric.result = models.MetricResult( name='ReleaseCherrypickCountMetric', value=3) self.assertEqual(self.metric.formatted_result, '3 PRs/90d')
def recompute(self) -> None: """Computes the metric and records the result in the `metrics` table.""" logging.info('Recomputing metric %s', self.name) self.result = models.MetricResult(value=self._compute_value(), name=self.name) logging.info('Updating metric %s value to %.3g', self.name, self.result.value) session = db.Session() session.add(self.result) session.commit()
def testFormattedResult(self): self.assertEqual(self.metric.formatted_result, '?') self.metric.result = models.MetricResult(name='TravisGreennessMetric', value=0.5) self.assertEqual(self.metric.formatted_result, '50.0%')
def testFormattedResult(self): self.assertEqual(self.metric.formatted_result, '?') self.metric.result = models.MetricResult( name='ReleaseGranularityMetric', value=15.6) self.assertEqual(self.metric.formatted_result, '16 c/r')
def testFormattedResult(self): self.assertEqual(self.metric.formatted_result, '?') self.metric.result = models.MetricResult( name='AbsoluteCoverageMetric', value=0.5) self.assertEqual(self.metric.formatted_result, '50.0%')
def assertValueHasScore(self, result_value, score): """Checks that result values are scored as expected.""" self.metric.result = models.MetricResult(name=self.metric.name, value=result_value) self.assertEqual(self.metric.score, score)
def testFormattedResult(self): self.assertEqual(self.metric.formatted_result, '?') self.metric.result = models.MetricResult(name='PresubmitLatencyMetric', value=15 * 60) self.assertEqual(self.metric.formatted_result, '15m')