From 3924d4bd3527e3f7f6b979147012cead8c64970c Mon Sep 17 00:00:00 2001 From: Eva Mrakova Date: Wed, 2 Aug 2023 14:39:57 +0200 Subject: [PATCH] Adjust extract_section_content_from_text for dnf5 --- dnf-behave-tests/dnf/steps/cmd.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dnf-behave-tests/dnf/steps/cmd.py b/dnf-behave-tests/dnf/steps/cmd.py index 455e8b20e..33ed8762a 100644 --- a/dnf-behave-tests/dnf/steps/cmd.py +++ b/dnf-behave-tests/dnf/steps/cmd.py @@ -31,11 +31,14 @@ def extract_section_content_from_text(section_header, text): parsed = '' copy = False for line in text.split('\n'): - if (not copy) and section_header == line: + strippedline = line.strip() + # in dnf5 there can be spaces after some section headers + # (e.g. 'Installing:', 'Upgrading:' etc.) + if (not copy) and section_header == strippedline: copy = True continue if copy: # copy lines until hitting empty line or another known header - if line.strip() and line not in SECTION_HEADERS: + if strippedline and strippedline not in SECTION_HEADERS: parsed += "%s\n" % line else: return parsed