fix cases where dict views could not be used in place of lists

This commit is contained in:
Mike Bonnet
2019-02-04 15:12:06 -08:00
committed by mprahl
parent 6e62cf6867
commit a44e1fe4b0
3 changed files with 7 additions and 5 deletions

View File

@@ -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"])

View File

@@ -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()))

View File

@@ -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': '',