From a44e1fe4b0ea8660c4ec85e241b9e69ed9482706 Mon Sep 17 00:00:00 2001 From: Mike Bonnet Date: Feb 08 2019 17:43:42 +0000 Subject: fix cases where dict views could not be used in place of lists --- diff --git a/module_build_service/builder/KojiContentGenerator.py b/module_build_service/builder/KojiContentGenerator.py index fe63863..9bd8f8a 100644 --- a/module_build_service/builder/KojiContentGenerator.py +++ b/module_build_service/builder/KojiContentGenerator.py @@ -36,6 +36,8 @@ import tempfile import time from io import open from collections import defaultdict +from itertools import chain + import kobo.rpmlib from six import text_type @@ -276,7 +278,7 @@ class KojiContentGenerator(object): # Handle the multicall result. For each build associated with the source RPM, # store the exclusivearch and excludearch lists. For each RPM, store the 'license' and # also other useful data from the Build associated with the RPM. - for rpm, headers in zip(src_rpms.values() + binary_rpms.values(), rpms_headers): + for rpm, headers in zip(chain(src_rpms.values(), binary_rpms.values()), rpms_headers): if not headers: raise RuntimeError( "No RPM headers received from Koji for RPM %s" % rpm["name"]) diff --git a/tests/__init__.py b/tests/__init__.py index ef9a062..a50e2cb 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -632,7 +632,7 @@ def reuse_shared_userspace_init_data(): session.add(build_one) - components = mmd.get_rpm_components().values() + components = list(mmd.get_rpm_components().values()) components.sort(key=lambda x: x.get_buildorder()) previous_buildorder = None batch = 1 @@ -683,7 +683,7 @@ def reuse_shared_userspace_init_data(): session.add(build_one) - components2 = mmd2.get_rpm_components().values() + components2 = list(mmd2.get_rpm_components().values()) # Store components to database in different order than for 570 to # reproduce the reusing issue. components2.sort(key=lambda x: len(x.get_name())) diff --git a/tests/test_utils/test_utils.py b/tests/test_utils/test_utils.py index dc034a5..a1ae02d 100644 --- a/tests/test_utils/test_utils.py +++ b/tests/test_utils/test_utils.py @@ -368,8 +368,8 @@ class TestUtils: mmd_pkg_refs = [pkg.get_ref() for pkg in mmd.get_rpm_components().values()] assert set(mmd_pkg_refs) == set(hashes_returned.keys()) br = mmd.get_dependencies()[0].get_buildrequires() - assert br.keys() == ['platform'] - assert br.values()[0].get() == ['f28'] + assert list(br.keys()) == ['platform'] + assert list(br.values())[0].get() == ['f28'] xmd = { 'mbs': { 'commit': '',