From 894bc32e6581c2af308d5b66c73622ddc38e94b3 Mon Sep 17 00:00:00 2001 From: Packit Service Date: Mar 14 2021 14:38:45 +0000 Subject: Apply patch 0017-Set-persistdir-for-fill-sack-from-repos-in-cache-tests-RhBug-1865803.patch patch_name: 0017-Set-persistdir-for-fill-sack-from-repos-in-cache-tests-RhBug-1865803.patch present_in_specfile: true location_in_specfile: 17 --- diff --git a/tests/test_fill_sack_from_repos_in_cache.py b/tests/test_fill_sack_from_repos_in_cache.py index f27235b..23fd2a4 100644 --- a/tests/test_fill_sack_from_repos_in_cache.py +++ b/tests/test_fill_sack_from_repos_in_cache.py @@ -42,7 +42,10 @@ class FillSackFromReposInCacheTest(unittest.TestCase): def _create_cache_for_repo(self, repopath, tmpdir): conf = dnf.conf.MainConf() conf.cachedir = os.path.join(tmpdir, "cache") - conf.installroot = os.path.join(tmpdir) + conf.installroot = tmpdir + conf.persistdir = os.path.join(conf.installroot, conf.persistdir.lstrip("/")) + conf.substitutions["arch"] = "x86_64" + conf.substitutions["basearch"] = dnf.rpm.basearch(conf.substitutions["arch"]) base = dnf.Base(conf=conf) @@ -69,7 +72,10 @@ class FillSackFromReposInCacheTest(unittest.TestCase): # Prepare base for the actual test conf = dnf.conf.MainConf() conf.cachedir = os.path.join(self.tmpdir, "cache") - conf.installroot = os.path.join(self.tmpdir) + conf.installroot = self.tmpdir + conf.persistdir = os.path.join(conf.installroot, conf.persistdir.lstrip("/")) + conf.substitutions["arch"] = "x86_64" + conf.substitutions["basearch"] = dnf.rpm.basearch(conf.substitutions["arch"]) self.test_base = dnf.Base(conf=conf) repoconf = dnf.repo.Repo(TEST_REPO_NAME, conf) repoconf.baseurl = self.repo_copy_path @@ -231,8 +237,13 @@ class FillSackFromReposInCacheTest(unittest.TestCase): q = self.test_base.sack.query() packages = q.run() - self.assertEqual(len(packages), 8) - self.assertEqual(packages[0].evr, "2.02-0.40") + + pkg_names = [] + for pkg in packages: + pkg_names.append(pkg.name) + + self.assertEqual(pkg_names, ['grub2', 'httpd', 'httpd', 'httpd-doc', 'httpd-doc', 'httpd-provides-name-doc', + 'httpd-provides-name-version-release-doc', 'libnghttp2']) self.module_base = dnf.module.module_base.ModuleBase(self.test_base) modules, _ = self.module_base._get_modules("base-runtime*")