From ae527a2e014dbe6757c70ce92d4aad0b390a9b31 Mon Sep 17 00:00:00 2001 From: Stepan Oksanichenko Date: Fri, 10 Nov 2023 18:08:03 +0200 Subject: [PATCH] - The unittests are fixed --- pungi/phases/pkgset/pkgsets.py | 63 -------------------------------- tests/test_pkgset_pkgsets.py | 2 + tests/test_pkgset_source_koji.py | 6 ++- 3 files changed, 7 insertions(+), 64 deletions(-) diff --git a/pungi/phases/pkgset/pkgsets.py b/pungi/phases/pkgset/pkgsets.py index b3f4f6e1..d0ffe1e2 100644 --- a/pungi/phases/pkgset/pkgsets.py +++ b/pungi/phases/pkgset/pkgsets.py @@ -894,69 +894,6 @@ class KojiPackageSet(PackageSetBase): class KojiMockPackageSet(KojiPackageSet): - def __init__( - self, - name, - koji_wrapper, - sigkey_ordering, - arches=None, - logger=None, - packages=None, - allow_invalid_sigkeys=False, - populate_only_packages=False, - cache_region=None, - extra_builds=None, - extra_tasks=None, - signed_packages_retries=0, - signed_packages_wait=30, - ): - """ - Creates new KojiPackageSet. - - :param list sigkey_ordering: Ordered list of sigkey strings. When - getting package from Koji, KojiPackageSet tries to get the package - signed by sigkey from this list. If None or "" appears in this - list, unsigned package is used. - :param list arches: List of arches to get the packages for. - :param logging.Logger logger: Logger instance to use for logging. - :param list packages: List of package names to be used when - `allow_invalid_sigkeys` or `populate_only_packages` is set. - :param bool allow_invalid_sigkeys: When True, packages *not* listed in - the `packages` list are added to KojiPackageSet even if they have - invalid sigkey. This is useful in case Koji tag contains some - unsigned packages, but we know they won't appear in a compose. - When False, all packages in Koji tag must have valid sigkey as - defined in `sigkey_ordering`. - :param bool populate_only_packages. When True, only packages in - `packages` list are added to KojiPackageSet. This can save time - when generating compose from predefined list of packages from big - Koji tag. - When False, all packages from Koji tag are added to KojiPackageSet. - :param dogpile.cache.CacheRegion cache_region: If set, the CacheRegion - will be used to cache the list of RPMs per Koji tag, so next calls - of the KojiPackageSet.populate(...) method won't try fetching it - again. - :param list extra_builds: Extra builds NVRs to get from Koji and include - in the package set. - :param list extra_tasks: Extra RPMs defined as Koji task IDs to get from Koji - and include in the package set. Useful when building testing compose - with RPM scratch builds. - """ - super(KojiMockPackageSet, self).__init__( - name, - koji_wrapper=koji_wrapper, - sigkey_ordering=sigkey_ordering, - arches=arches, - logger=logger, - packages=packages, - allow_invalid_sigkeys=allow_invalid_sigkeys, - populate_only_packages=populate_only_packages, - cache_region=cache_region, - extra_builds=extra_builds, - extra_tasks=extra_tasks, - signed_packages_retries=signed_packages_retries, - signed_packages_wait=signed_packages_wait, - ) def _is_rpm_signed(self, rpm_path) -> bool: ts = rpm.TransactionSet() diff --git a/tests/test_pkgset_pkgsets.py b/tests/test_pkgset_pkgsets.py index 5db88319..2fc81da6 100644 --- a/tests/test_pkgset_pkgsets.py +++ b/tests/test_pkgset_pkgsets.py @@ -932,6 +932,8 @@ class TestReuseKojiPkgset(helpers.PungiTestCase): "include_packages": None, "rpms_by_arch": mock.Mock(), "srpms_by_name": mock.Mock(), + "inherit_to_noarch": True, + "exclusive_noarch": True, } ) self.pkgset.old_file_cache = mock.Mock() diff --git a/tests/test_pkgset_source_koji.py b/tests/test_pkgset_source_koji.py index 2ea82363..c3d8058a 100644 --- a/tests/test_pkgset_source_koji.py +++ b/tests/test_pkgset_source_koji.py @@ -839,6 +839,7 @@ class TestAddModuleToVariantForKojiMock(helpers.PungiTestCase): super(TestAddModuleToVariantForKojiMock, self).setUp() self.koji = mock.Mock() self.koji.koji_module.pathinfo.typedir.return_value = "/koji" + self.compose = helpers.DummyCompose(self.topdir, {}) self.koji.koji_module.pathinfo.topdir = MMDS_DIR files = [ "modulemd.x86_64.txt", @@ -897,7 +898,10 @@ class TestAddModuleToVariantForKojiMock(helpers.PungiTestCase): modules=[{"name": "m1:latest-20190101:cafe", "glob": False}], ) - source_koji._add_module_to_variant(self.koji, variant, self.buildinfo) + + source_koji._add_module_to_variant( + self.koji, variant, self.buildinfo, compose=self.compose + ) mod = variant.arch_mmds["x86_64"]["m1:latest:20190101:cafe"] self.assertEqual(mod.get_NSVCA(), "m1:latest:20190101:cafe:x86_64")