Skip to contentSkip to conversation

tests: py: fix python3.

PATCH Shekhar Sharma 1 participant 1 message May 23, 2019 netfilter

lore
Share & tools
lore

Shekhar Sharma

author Acked-by Eric Garver
#0 lore raw

Yes, the '\' can be removed, will remove it if I make any other changes in the future.

Thanks Eric, Pablo and Shivani for all your hints :-).

Shekhar

On Fri, May 24, 2019, 12:45 AM shekhar sharma <[email protected]> wrote:
Yes, the '\' can be removed, will remove it if I make any other changes in the future.

Thanks Eric, Pablo and Shivani for all your hints :-).

Shekhar

On Fri, May 24, 2019, 12:41 AM Eric Garver <[email protected]> wrote:

Quoted 5 lines · Shekhar Sharma

This version of the patch converts the file into python3 and also uses .format() method to make the print statments cleaner.

The version history of this topic is:

Quoted 8 lines

v1: conversion to py3 by changing print statements.
v2: adds the '__future__' package for compatibility with py2 and py3.
v3: solves the 'version' problem in argparse by adding a new argument.
v4: uses .format() method to make the print statements cleaner.

---

Quoted 7 lines
 tests/py/nft-test.py | 47 ++++++++++++++++++++++++--------------------
 1 file changed, 26 insertions(+), 21 deletions(-)
tests/py/nft-test.py +0 -0
index 1c0afd0e..ab26d08d 100755

[..]

Quoted 6 lines
tests/py/nft-test.py +1 -1
@@ -1353,15 +1358,15 @@ def main():
     signal.signal(signal.SIGTERM, signal_handler)
 
     if os.getuid() != 0:
-        print "You need to be root to run this, sorry"
+        print("You need to be root to run this, sorry")

tests/py/nft-test.py def main(): · line 1369

Quoted 10 lines
tests/py/nft-test.py +2 -2
         return
 
     # Change working directory to repository root
     os.chdir(TESTS_PATH + "/../..")
 
     if not os.path.exists('src/.libs/libnftables.so'):
-        print "The nftables library does not exist. " \
-              "You need to build the project."
+        print("The nftables library does not exist. " \
+              "You need to build the project.")

nit: The trailing '\' can be removed now that the strings are inside parenthesis. I don't think it's worth rerolling the patch though.