Thanks for fixing my janky code, Dumitru :)

Acked-by: Mark Michelson <[email protected]>

On 8/16/22 10:53, Dumitru Ceara wrote:
This commit also fixes some output issues due to truncated lines
within f-strings or acl log lines that include trailing whitespace
in check_acl_log.py.  It also implicitly fixes the flake8 reported
issue:
   tests/check_acl_log.py:94:80: E501 line too long (80 > 79 characters)

Signed-off-by: Dumitru Ceara <[email protected]>
---
V2:
- Addressed Ilya's comments.
- Fixed formatting for all f-string generated output.
- Removed trailing whitespace from logs.
---
  tests/check_acl_log.py |   16 +++++++++-------
  1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/tests/check_acl_log.py b/tests/check_acl_log.py
index 1dd9630c0..0c1968b2e 100644
--- a/tests/check_acl_log.py
+++ b/tests/check_acl_log.py
@@ -37,13 +37,14 @@ def parse_acl_log(line):
def get_acl_log(entry_num=1):
      with open("ovn-controller.log", "r") as controller_log:
-        acl_logs = [line for line in controller_log if "acl_log" in line]
+        acl_logs = [line.rstrip() for line in controller_log
+                    if "acl_log" in line]
          try:
              return acl_logs[entry_num - 1]
          except IndexError:
              print(
-                f"There were not {entry_num} acl_log entries, \
-                only {len(acl_logs)}"
+                f"There were not {entry_num} acl_log entries, "
+                f"only {len(acl_logs)}"
              )
              exit(1)
@@ -91,14 +92,15 @@ def main():
          try:
              if parsed_log[key] != val:
                  print(
-                    f"Expected log {key}={val} but got {key}={parsed_log[key]} 
\
-                    in:\n\t'{acl_log}"
+                    f"Expected log {key}={val} but got "
+                    f"{key}={parsed_log[key]} "
+                    f"in:\n\t'{acl_log}'"
                  )
                  exit(1)
          except KeyError:
              print(
-                f"Expected log {key}={val} but {key} does not exist \
-                in:\n\t'{acl_log}'"
+                f"Expected log {key}={val} but {key} does not exist in:\n"
+                f"\t'{acl_log}'"
              )
              exit(1)

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to