Change in python/osmo-python-tests[master]: osmo_interact/common: ignore trailing empty lines in received results

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Tue Sep 11 00:41:47 UTC 2018


Neels Hofmeyr has submitted this change and it was merged. ( https://gerrit.osmocom.org/10866 )

Change subject: osmo_interact/common: ignore trailing empty lines in received results
......................................................................

osmo_interact/common: ignore trailing empty lines in received results

If the VTY/CTRL output contains trailing newlines, do not cause those to
trigger mismatch errors, rather drop those.

Rationale: in transcript scripts, the amount of empty lines between expected
results is ignored, to allow cosmetically arranging into sections. So trailing
newlines are dropped, and there is no way to preserve those.

Change-Id: I1930868451c5738b17e318a9807590d948210b9a
---
M osmopy/osmo_interact/common.py
1 file changed, 4 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Neels Hofmeyr: Looks good to me, approved



diff --git a/osmopy/osmo_interact/common.py b/osmopy/osmo_interact/common.py
index 31f44a8..39163a2 100644
--- a/osmopy/osmo_interact/common.py
+++ b/osmopy/osmo_interact/common.py
@@ -175,6 +175,10 @@
                 step.verify_interact_state(self)
 
                 res = self.command(step.command)
+                # trailing empty lines in the command output cannot be preserved because we allow
+                # arbitrary newlines between commands. Do not even track these.
+                while res and not res[-1]:
+                    res = res[:-1]
 
                 if self.verbose:
                     sys.stderr.flush()

-- 
To view, visit https://gerrit.osmocom.org/10866
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: python/osmo-python-tests
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I1930868451c5738b17e318a9807590d948210b9a
Gerrit-Change-Number: 10866
Gerrit-PatchSet: 2
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180911/78d4fbc0/attachment.htm>


More information about the gerrit-log mailing list