def _compute_value(self) -> float: """Determines the code coverage percentage from Codecov. Returns: The percentage of lines tested in HEAD. """ return codecov.CodecovApi().get_absolute_coverage() / 100
def setUp(self): super(TestCodecovApi, self).setUp() mock.patch.object( env, 'get', side_effect={ 'GITHUB_REPO': '__repo__', }.get).start() self.mock_request = mock.patch.object( agithub_base.Client, 'request', autospec=True).start() self.addCleanup(mock.patch.stopall) self.codecov_api = codecov.CodecovApi()
def _compute_value(self) -> float: """Determines the code coverage percentage from Codecov. Returns: The percentage of lines tested in HEAD. """ session = db.Session() head_commit = session.query(models.Commit).filter( models.Commit.committed_at < self.base_time).order_by( models.Commit.committed_at.desc()).first() session.close() if not head_commit: raise ValueError('No commit available before %s' % self.base_time) return codecov.CodecovApi().get_absolute_coverage(head_commit.hash) / 100