Re: [PATCH nft v3]tests: py: fix python3.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Shekar,

Thanks for your patch, comments below.

On Wed, May 22, 2019 at 02:37:04PM +0530, Shekhar Sharma wrote:
> This patch solves the problem with the 'version' in the constructor of
> argparse (line 1325). A new argument has been added for printing the version.
> Now the file will run in python2 as well as python3.
>
> Thanks eric for the hint! :-)

Please, keep the original patch description between patch versions.

> Signed-off-by: Shekhar Sharma <shekhar250198@xxxxxxxxx>
> ---

Here, after the '---' above, you can place incremental updates versus
previous patch version, for example:

v3: This patch solves the problem with the 'version' in the
    constructor of argparse (line 1325). A new argument has been added for
    printing the version. Now the file will run in python2 as well as
    python3. Thanks eric for the hint! :-)

More comments below.

>  tests/py/nft-test.py | 125 ++++++++++++++++++++++++++++++-------------
>  1 file changed, 88 insertions(+), 37 deletions(-)
>
> diff --git a/tests/py/nft-test.py b/tests/py/nft-test.py
> index 1c0afd0e..bb643ccc 100755
> --- a/tests/py/nft-test.py
> +++ b/tests/py/nft-test.py
> @@ -13,6 +13,8 @@
>  # Thanks to the Outreach Program for Women (OPW) for sponsoring this test
>  # infrastructure.
>
> +from __future__ import print_function
> +#from nftables import Nftables
>  import sys
>  import os
>  import argparse
> @@ -22,7 +24,6 @@ import json
>  TESTS_PATH = os.path.dirname(os.path.abspath(__file__))
>  sys.path.insert(0, os.path.join(TESTS_PATH, '../../py/'))
>
> -from nftables import Nftables
>
>  TESTS_DIRECTORY = ["any", "arp", "bridge", "inet", "ip", "ip6"]
>  LOGFILE = "/tmp/nftables-test.log"
> @@ -171,27 +172,31 @@ def print_differences_error(filename, lineno, cmd):
>      print_error(reason, filename, lineno)
>
>
> -def table_exist(table, filename, lineno):
> +def table_exist(table, filename, lineno, netns):
>      '''
>      Exists a table.
>      '''
>      cmd = "list table %s" % table
> +    if netns:
> +        cmd = "ip netns exec ___nftables-container-test" + cmd

It seems you're mixing the fix for Python3 and with the netns support.

Please, keep two separated patches for this; policy is "one logic
change per patch", and this would include two logic changes.

Thanks.



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux