From 4b40a1258a36332b2b968fd6792d8a55f5b11c11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Mon, 11 Sep 2017 11:16:58 +0200 Subject: [PATCH] gather: Capture broken deps in test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will help test more aspects of depsolving. Signed-off-by: Lubomír Sedlář --- tests/test_gather.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/test_gather.py b/tests/test_gather.py index 03076f63..80218036 100644 --- a/tests/test_gather.py +++ b/tests/test_gather.py @@ -12,6 +12,8 @@ import shutil import sys import logging +from six.moves import cStringIO + HERE = os.path.dirname(__file__) BINDIR = (os.path.join(HERE, '..', 'bin')) 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) 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) @@ -1674,7 +1676,18 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): exclude_groups = [] _, conditional_packages = self.dnf.comps_wrapper.get_comps_packages(groups, exclude_groups) 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) + log_output.seek(0) + _, self.broken_deps, _ = PungiWrapper().parse_log(log_output) return { 'debuginfo': convert_dnf_packages(self.g.result_debug_packages,