Beispiel #1
0
    def test_projects_depsolve_version(self):
        """Test that depsolving with a partial wildcard version works"""
        deps = projects_depsolve(self.dbo, [("bash", "5.*")], [])
        self.assertEqual(deps[1]["name"], "bash")

        deps = projects_depsolve(self.dbo, [("bash", "5.0.*")], [])
        self.assertEqual(deps[1]["name"], "bash")
Beispiel #2
0
def test_templates(dbo, share_dir):
    """ Try depsolving each of the the templates and report any errors

    :param dbo: dnf base object
    :type dbo: dnf.Base
    :returns: List of template types and errors
    :rtype: List of errors

    Return a list of templates and errors encountered or an empty list
    """
    template_errors = []
    for compose_type in compose_types(share_dir):
        # Read the kickstart template for this type
        ks_template_path = joinpaths(share_dir, "composer",
                                     compose_type) + ".ks"
        ks_template = open(ks_template_path, "r").read()

        # How much space will the packages in the default template take?
        ks_version = makeVersion()
        ks = KickstartParser(ks_version,
                             errorsAreFatal=False,
                             missingIncludeIsFatal=False)
        ks.readKickstartFromString(ks_template + "\n%end\n")
        pkgs = [(name, "*") for name in ks.handler.packages.packageList]
        grps = [grp.name for grp in ks.handler.packages.groupList]
        try:
            _ = projects_depsolve(dbo, pkgs, grps)
        except ProjectsError as e:
            template_errors.append("Error depsolving %s: %s" %
                                   (compose_type, str(e)))

    return template_errors
Beispiel #3
0
 def test_groups_depsolve(self):
     deps = projects_depsolve(self.dbo, [], ["c-development"])
     names = [grp["name"] for grp in deps]
     self.assertTrue("autoconf" in names)  # mandatory package
     self.assertTrue("ctags" in names)  # default package
     self.assertFalse("cmake" in names)  # optional package
Beispiel #4
0
 def test_projects_depsolve_fail(self):
     with self.assertRaises(ProjectsError):
         projects_depsolve(self.dbo, [("nada-package", "*.*")], [])
Beispiel #5
0
 def test_projects_depsolve_oldversion(self):
     """Test that depsolving a specific non-existant version fails"""
     with self.assertRaises(ProjectsError):
         deps = projects_depsolve(self.dbo, [("bash", "1.0.0")], [])
         self.assertEqual(deps[1]["name"], "bash")
Beispiel #6
0
 def test_projects_depsolve(self):
     deps = projects_depsolve(self.dbo, [("bash", "*.*")], [])
     self.assertTrue(len(deps) > 3)
     self.assertTrue("basesystem" in [dep["name"] for dep in deps])
Beispiel #7
0
    def test_projects_depsolve(self):
        deps = projects_depsolve(self.dbo, [("bash", "*.*")])

        self.assertEqual(deps[0]["name"], "basesystem")
Beispiel #8
0
 def test_cdbootglob_depsolve(self):
     """Test that requesting grub2-efi-*-cdboot pulls in a cdboot package"""
     deps = projects_depsolve(self.dbo, [("grub2-efi-*-cdboot", "*")], [])
     self.assertTrue(len(deps) > 0)
     self.assertTrue(any(True for dep in deps if "-cdboot" in dep["name"]))
Beispiel #9
0
 def test_shim_depsolve(self):
     """Test that requesting shim pulls in shim-*"""
     deps = projects_depsolve(self.dbo, [("shim", "*")], [])
     self.assertTrue(len(deps) > 0)
     self.assertTrue(any(True for dep in deps if "shim-" in dep["name"]))