gather: Capture broken deps in test

This will help test more aspects of depsolving.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2017-09-11 11:16:58 +02:00
parent 816ab917da
commit 4b40a1258a

View File

@ -12,6 +12,8 @@ import shutil
import sys import sys
import logging import logging
from six.moves import cStringIO
HERE = os.path.dirname(__file__) HERE = os.path.dirname(__file__)
BINDIR = (os.path.join(HERE, '..', 'bin')) BINDIR = (os.path.join(HERE, '..', 'bin'))
sys.path.insert(0, os.path.join(HERE, '..')) sys.path.insert(0, os.path.join(HERE, '..'))
@ -1618,7 +1620,7 @@ class PungiYumDepsolvingTestCase(DepsolvingBase, unittest.TestCase):
p.run_pungi(self.ks, self.tmp_dir, 'DP', **kwargs) p.run_pungi(self.ks, self.tmp_dir, 'DP', **kwargs)
with open(self.out, "r") as f: with open(self.out, "r") as f:
pkg_map, _, _ = p.parse_log(f) pkg_map, self.broken_deps, _ = p.parse_log(f)
return convert_pkg_map(pkg_map) return convert_pkg_map(pkg_map)
@ -1674,7 +1676,18 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase):
exclude_groups = [] exclude_groups = []
_, conditional_packages = self.dnf.comps_wrapper.get_comps_packages(groups, exclude_groups) _, conditional_packages = self.dnf.comps_wrapper.get_comps_packages(groups, exclude_groups)
self.g = Gather(self.dnf, GatherOptions(**kwargs)) self.g = Gather(self.dnf, GatherOptions(**kwargs))
self.g.logger.handlers = [h for h in self.g.logger.handlers
if h.name != 'capture-logs']
log_output = cStringIO()
handler = logging.StreamHandler(log_output)
handler.name = 'capture-logs'
handler.setLevel(logging.WARNING)
self.g.logger.addHandler(handler)
self.g.gather(packages, conditional_packages) self.g.gather(packages, conditional_packages)
log_output.seek(0)
_, self.broken_deps, _ = PungiWrapper().parse_log(log_output)
return { return {
'debuginfo': convert_dnf_packages(self.g.result_debug_packages, 'debuginfo': convert_dnf_packages(self.g.result_debug_packages,