def test_parser_gets_correct_targets(self): parser = BuildTargetParser(self.releasers_config, self.release_target, self.valid_branches) release_targets = parser.get_build_targets() self.assertTrue("branch1" in release_targets) self.assertEqual("project-x.y.z-candidate", release_targets["branch1"]) self.assertFalse("branch2" in release_targets)
def __init__(self, name=None, tag=None, build_dir=None, config=None, user_config=None, target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False, **kwargs): Releaser.__init__(self, name, tag, build_dir, config, user_config, target, releaser_config, no_cleanup, test, auto_accept, **kwargs) if 'FEDPKG_USER' in user_config: self.cli_tool = "fedpkg --user=%s" % user_config["FEDPKG_USER"] else: self.cli_tool = "fedpkg" self.git_branches = \ self.releaser_config.get(self.target, "branches").split(" ") if self.config.has_option(self.target, "remote_git_name"): overwrite_checkout = self.config.get(self.target, "remote_git_name") else: overwrite_checkout = None if overwrite_checkout: self.project_name = overwrite_checkout self.package_workdir = os.path.join(self.working_dir, self.project_name) build_target_parser = BuildTargetParser(self.releaser_config, self.target, self.git_branches) self.build_targets = build_target_parser.get_build_targets() # Files we should copy to git during a release: self.copy_extensions = (".spec", ".patch")
def __init__(self, name=None, version=None, tag=None, build_dir=None, pkg_config=None, global_config=None, user_config=None, target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False): Releaser.__init__(self, name, version, tag, build_dir, pkg_config, global_config, user_config, target, releaser_config, no_cleanup, test, auto_accept) self.git_branches = \ self.releaser_config.get(self.target, "branches").split(" ") if self.config.has_option(self.target, "remote_git_name"): overwrite_checkout = self.config.get(self.target, "remote_git_name") else: overwrite_checkout = None if overwrite_checkout: self.project_name = overwrite_checkout self.package_workdir = os.path.join(self.working_dir, self.project_name) build_target_parser = BuildTargetParser(self.releaser_config, self.target, self.git_branches) self.build_targets = build_target_parser.get_build_targets()
def test_multiple_spaces_ok(self): self.releasers_config.set(self.release_target, "build_targets", " branch1:project-x.y.z-candidate ") parser = BuildTargetParser(self.releasers_config, self.release_target, self.valid_branches) release_targets = parser.get_build_targets() self.assertEqual(1, len(release_targets)) self.assertTrue("branch1" in release_targets) self.assertEqual("project-x.y.z-candidate", release_targets["branch1"])
def test_multiple_branches_supported(self): self.releasers_config.set( self.release_target, "build_targets", "branch1:project-x.y.z-candidate branch2:second-target" ) parser = BuildTargetParser(self.releasers_config, self.release_target, self.valid_branches) release_targets = parser.get_build_targets() self.assertEquals(2, len(release_targets)) self.assertTrue("branch1" in release_targets) self.assertEqual("project-x.y.z-candidate", release_targets["branch1"]) self.assertTrue("branch2" in release_targets) self.assertEqual("second-target", release_targets["branch2"])
def test_multiple_branches_supported(self): self.releasers_config.set(self.release_target, "build_targets", "branch1:project-x.y.z-candidate branch2:second-target") parser = BuildTargetParser(self.releasers_config, self.release_target, self.valid_branches) release_targets = parser.get_build_targets() self.assertEquals(2, len(release_targets)) self.assertTrue("branch1" in release_targets) self.assertEqual("project-x.y.z-candidate", release_targets["branch1"]) self.assertTrue("branch2" in release_targets) self.assertEqual("second-target", release_targets['branch2'])
def __init__(self, name=None, version=None, tag=None, build_dir=None, pkg_config=None, global_config=None, user_config=None, target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False): Releaser.__init__(self, name, version, tag, build_dir, pkg_config, global_config, user_config, target, releaser_config, no_cleanup, test, auto_accept) self.git_branches = \ self.releaser_config.get(self.target, "branches").split(" ") self.package_workdir = os.path.join(self.working_dir, self.project_name) build_target_parser = BuildTargetParser(self.releaser_config, self.target, self.git_branches) self.build_targets = build_target_parser.get_build_targets()
def test_empty_target_raises_exception(self): self.releasers_config.set(self.release_target, "build_targets", "branch1:") parser = BuildTargetParser(self.releasers_config, self.release_target, self.valid_branches) self.assertRaises(TitoException, parser.get_build_targets)
def test_empty_branch_raises_exception(self): self.releasers_config.set(self.release_target, "build_targets", ":project-x.y.z-candidate") parser = BuildTargetParser(self.releasers_config, self.release_target, self.valid_branches) self.assertRaises(TitoException, parser.get_build_targets)