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')
示例#2
0
    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')
示例#3
0
    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')
示例#4
0
    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()
示例#5
0
    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%')
示例#6
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')
示例#7
0
 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%')
示例#8
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')