]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: py: Make diff functions use print_* functions
authorMáté Eckl <ecklm94@gmail.com>
Thu, 17 May 2018 07:37:02 +0000 (09:37 +0200)
committerFlorian Westphal <fw@strlen.de>
Thu, 17 May 2018 13:36:19 +0000 (15:36 +0200)
Signed-off-by: Máté Eckl <ecklm94@gmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
tests/py/nft-test.py

index b536e9cdd813cf4db511d1aa8c1457d89bf8bff7..edc0b4b11daf73518e151bfe0590ff6374cc689f 100755 (executable)
@@ -161,15 +161,13 @@ def color_differences(rule, other, color):
 def print_differences_warning(filename, lineno, rule1, rule2, cmd):
     colored_rule1 = color_differences(rule1, rule2, Colors.YELLOW)
     colored_rule2 = color_differences(rule2, rule1, Colors.YELLOW)
-    reason = "'" + colored_rule1 + "' mismatches '" + colored_rule2 + "'"
-    print filename + ": " + Colors.YELLOW + "WARNING: " + Colors.ENDC + \
-          "line: " + str(lineno + 1) + ": '" + cmd + "': " + reason
+    reason = "'%s': '%s' mismatches '%s'" % (cmd, colored_rule1, colored_rule2)
+    print_warning(reason, filename, lineno)
 
 
 def print_differences_error(filename, lineno, cmd):
-    reason = "Listing is broken."
-    print filename + ": " + Colors.RED + "ERROR: " + Colors.ENDC + "line: " + \
-          str(lineno + 1) + ": '" + cmd + "': " + reason
+    reason = "'%s': Listing is broken." % cmd
+    print_error(reason, filename, lineno)
 
 
 def table_exist(table, filename, lineno):