summaryrefslogtreecommitdiffstats
path: root/tests/regression/nft-test.py
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2015-06-04 20:57:20 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2015-06-04 20:57:20 +0200
commit7c357801945977a7a7759ead56b4cb320673219b (patch)
treed90c08dcd9286f37b9cfe24a4eabb5f73fb454de /tests/regression/nft-test.py
parent933fb6b993d9ddd9a96d15edbea393dc56c932e3 (diff)
parent575cc4519aa177c573481f683e07c2789a2f870a (diff)
Merge branch 'next-4.1'
Diffstat (limited to 'tests/regression/nft-test.py')
-rwxr-xr-xtests/regression/nft-test.py19
1 files changed, 7 insertions, 12 deletions
diff --git a/tests/regression/nft-test.py b/tests/regression/nft-test.py
index 559ad41f..7823f44c 100755
--- a/tests/regression/nft-test.py
+++ b/tests/regression/nft-test.py
@@ -44,26 +44,21 @@ class Colors:
RED = ''
ENDC = ''
-def print_error(reason, filename=None, lineno=None):
+def print_msg(reason, filename=None, lineno=None, color=None, errstr=None):
'''
- Prints an error with nice colors, indicating file and line number.
+ Prints a message with nice colors, indicating file and line number.
'''
if filename and lineno:
- print (filename + ": " + Colors.RED + "ERROR:" +
+ print (filename + ": " + color + "ERROR:" +
Colors.ENDC + " line %d: %s" % (lineno + 1, reason))
else:
- print (Colors.RED + "ERROR:" + Colors.ENDC + " %s" % (reason))
+ print (color + "ERROR:" + Colors.ENDC + " %s" % (reason))
+def print_error(reason, filename=None, lineno=None):
+ print_msg(reason, filename, lineno, Colors.RED, "ERROR:")
def print_warning(reason, filename=None, lineno=None):
- '''
- Prints a warning with nice colors, indicating file and line number.
- '''
- if filename and lineno:
- print (filename + ": " + Colors.YELLOW + "WARNING:" + \
- Colors.ENDC + " line %d: %s" % (lineno + 1, reason))
- else:
- print (Colors.YELLOW + "WARNING:" + " %s" % (reason))
+ print_msg(reason, filename, lineno, Colors.YELLOW, "WARNING:")
def print_differences_warning(filename, lineno, rule1, rule2, cmd):