示例#1
0
文件: api.py 项目: jscotka/packit
    def status(self):

        status = Status(self.config, self.package_config)

        status.get_downstream_prs()
        status.get_dg_versions()
        status.get_up_releases()
        status.get_builds()
        status.get_updates()
示例#2
0
def test_get_builds(upstream_n_distgit, expected_results, br_list, number_of_builds):
    u, d = upstream_n_distgit
    from bodhi.client.bindings import BodhiClient

    c = get_test_config()
    pc = get_local_package_config(str(u))
    pc.downstream_project_url = str(d)
    pc.upstream_project_url = str(u)
    dg = DistGit(c, pc)
    pc = get_local_package_config(str(u))
    flexmock(BodhiClient).should_receive("latest_builds").and_return(
        BODHI_LATEST_BUILDS
    )
    status = Status(c, pc, u, dg)
    flexmock(
        PagureProject,
        get_git_urls=lambda: {"git": "foo.git"},
        fork_create=lambda: None,
        get_fork=lambda: PagureProject("", "", PagureService()),
        get_branches=br_list,
    )
    assert status
    table = status.get_builds(number_of_builds)
    assert table
    assert len(table.keys()) == number_of_builds
    assert table == expected_results
示例#3
0
class TestStatus(PackitUnittestOgr):
    def setUp(self):
        super().setUp()
        self.status = Status(self.conf, self.pc, self.upstream, self.dg)

    def test_status(self):
        assert self.status

    def test_distgen_versions(self):
        table = self.status.get_dg_versions()
        assert table
        assert len(table) >= 3

    def test_builds(self):
        table = self.status.get_builds()
        assert table
        assert len(table) >= 2

    def test_updates(self):
        table = self.status.get_updates()
        assert table
        assert len(table) >= 3

    def test_up_releases(self):
        table = self.status.get_up_releases()
        assert len(table) >= 5

    def test_dowstream_pr(self):
        table = self.status.get_downstream_prs()
        assert len(table) == 0
示例#4
0
文件: api.py 项目: jlebon/packit
    def status(self):
        status = Status(self.config, self.package_config, self.up, self.dg)

        ds_prs = status.get_downstream_prs()
        if ds_prs:
            logger.info("Downstream PRs:")
            logger.info(tabulate(ds_prs, headers=["ID", "Title", "URL"]))
        else:
            logger.info("Downstream PRs: No open PRs.")
        status.get_dg_versions()
        status.get_up_releases()
        builds = status.get_builds()
        if builds:
            logger.info("\nLatest builds:")
            for build in builds:
                koji_builds_str = "\n".join(f" - {b}" for b in builds[build])
                logger.info(f"{build}:\n{koji_builds_str}")
        else:
            logger.info("There are no builds.")

        updates = status.get_updates()
        if updates:
            logger.info("\nLatest bodhi updates:")
            logger.info(
                tabulate(updates, headers=["Update", "Karma", "status"]))
示例#5
0
class TestStatus(PackitUnittestOgr):
    def setUp(self):
        DataMiner.key = f'github-{pkg_resources.get_distribution("PyGithub").version}'
        DataMiner.data_type = DataTypes.Dict
        super().setUp()
        self.status = Status(self.conf, self.pc, self.upstream, self.dg)

    def test_status(self):
        assert self.status

    def test_distgen_versions(self):
        table = self.status.get_dg_versions()
        assert table
        assert len(table) >= 3

    def test_builds(self):
        table = self.status.get_builds()
        assert table
        assert len(table) >= 2

    def test_updates(self):
        table = self.status.get_updates()
        assert table
        assert len(table) >= 3

        # Check if get_updates doesn't return more than one stable update per branch
        stable_branches = []
        for [update, _, status] in table:
            branch = update[-4:]
            if status == "stable":
                stable_branches.append(branch)
        assert len(set(stable_branches)) == len(stable_branches)

    @unittest.skip("The replaying does not work.")
    def test_up_releases(self):
        table = self.status.get_up_releases()
        assert len(table) >= 5

    def test_dowstream_pr(self):
        table = self.status.get_downstream_prs()
        assert len(table) >= 0
示例#6
0
文件: api.py 项目: G-girl85/packit
    def status(self):
        status = Status(self.config, self.package_config, self.up, self.dg)

        ds_prs = status.get_downstream_prs()
        if ds_prs:
            logger.info("Downstream PRs:")
            logger.info(tabulate(ds_prs, headers=["ID", "Title", "URL"]))
        else:
            logger.info("Downstream PRs: No open PRs.")

        dg_versions = status.get_dg_versions()
        if dg_versions:
            logger.info("Dist-git versions:")
            for branch, dg_version in dg_versions.items():
                logger.info(f"{branch}: {dg_version}")

        up_releases = status.get_up_releases()
        if up_releases:
            logger.info("\nGitHub upstream releases:")
            upstream_releases_str = "\n".join(f"{release.tag_name}"
                                              for release in up_releases)
            logger.info(upstream_releases_str)
        else:
            logger.info("\nGitHub upstream releases: No releases found.")

        builds = status.get_builds()
        if builds:
            logger.info("\nLatest builds:")
            for build in builds:
                koji_builds_str = "\n".join(f" - {b}" for b in builds[build])
                logger.info(f"{build}:\n{koji_builds_str}")
        else:
            logger.info("There are no builds.")

        updates = status.get_updates()
        if updates:
            logger.info("\nLatest bodhi updates:")
            logger.info(
                tabulate(updates, headers=["Update", "Karma", "status"]))
示例#7
0
class TestStatus(PackitUnittestOgr):
    def setUp(self):
        super().setUp()
        self.status = Status(self.conf, self.pc, self.upstream, self.dg)

    def test_status(self):
        assert self.status

    def test_distgen_versions(self):
        table = self.status.get_dg_versions()
        assert table
        assert len(table) >= 3

    def test_builds(self):
        table = self.status.get_builds()
        assert table
        assert len(table) >= 2

    def test_updates(self):
        table = self.status.get_updates()
        assert table
        assert len(table) >= 3

        # Check if get_updates doesn't return more than one stable update per branch
        stable_branches = []
        for [update, _, status] in table:
            branch = update[-4:]
            if status == "stable":
                stable_branches.append(branch)
        assert len(set(stable_branches)) == len(stable_branches)

    def test_up_releases(self):
        table = self.status.get_up_releases()
        assert len(table) >= 5

    def test_dowstream_pr(self):
        table = self.status.get_downstream_prs()
        assert len(table) == 0