def _check_is_up_to_date(the_branch): info = _get_package_branch_info(the_branch.base) if info is None: return c = the_branch.get_config_stack() verbosity = c.get('launchpad.packaging_verbosity') if not verbosity: trace.mutter('not checking %s because verbosity is turned off' % (the_branch.base, )) return archive, series, project = info from bzrlib.plugins.launchpad import lp_api_lite latest_pub = lp_api_lite.LatestPublication(archive, series, project) lp_api_lite.report_freshness(the_branch, verbosity, latest_pub)
def _check_is_up_to_date(the_branch): info = _get_package_branch_info(the_branch.base) if info is None: return c = the_branch.get_config_stack() verbosity = c.get('launchpad.packaging_verbosity') if not verbosity: trace.mutter('not checking %s because verbosity is turned off' % (the_branch.base,)) return archive, series, project = info from bzrlib.plugins.launchpad import lp_api_lite latest_pub = lp_api_lite.LatestPublication(archive, series, project) lp_api_lite.report_freshness(the_branch, verbosity, latest_pub)
def assertFreshnessReports(self, verbosity, latest_version, content): """Assert that lp_api_lite.report_freshness reports the given content. :param verbosity: The reporting level :param latest_version: The version reported by StubLatestPublication :param content: The expected content. This should be in DocTest form. """ orig_log_len = len(self.get_log()) lp_api_lite.report_freshness(self.branch, verbosity, StubLatestPublication(latest_version)) new_content = self.get_log()[orig_log_len:] # Strip out lines that have LatestPublication.get_* because those are # timing related lines. While interesting to log for now, they aren't # something we want to be testing new_content = new_content.split('\n') for i in range(2): if (len(new_content) > 0 and 'LatestPublication.get_' in new_content[0]): new_content = new_content[1:] new_content = '\n'.join(new_content) self.assertThat(new_content, DocTestMatches(content, doctest.ELLIPSIS | doctest.REPORT_UDIFF))
def assertFreshnessReports(self, verbosity, latest_version, content): """Assert that lp_api_lite.report_freshness reports the given content. :param verbosity: The reporting level :param latest_version: The version reported by StubLatestPublication :param content: The expected content. This should be in DocTest form. """ orig_log_len = len(self.get_log()) lp_api_lite.report_freshness(self.branch, verbosity, StubLatestPublication(latest_version)) new_content = self.get_log()[orig_log_len:] # Strip out lines that have LatestPublication.get_* because those are # timing related lines. While interesting to log for now, they aren't # something we want to be testing new_content = new_content.split('\n') for i in range(2): if (len(new_content) > 0 and 'LatestPublication.get_' in new_content[0]): new_content = new_content[1:] new_content = '\n'.join(new_content) self.assertThat( new_content, DocTestMatches(content, doctest.ELLIPSIS | doctest.REPORT_UDIFF))
def test_verbosity_off(self): latest_pub = StubLatestPublication('1.0-1ubuntu2') lp_api_lite.report_freshness(self.branch, 'off', latest_pub) self.assertFalse(latest_pub.called)
def test_verbosity_off(self): latest_pub = StubLatestPublication('1.0-1ubuntu2') lp_api_lite.report_freshness(self.branch, 'off', latest_pub) self.assertFalse(latest_pub.called)