netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Shekhar Sharma <shekhar250198@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft v3]tests: py: fix python3.
Date: Wed, 22 May 2019 12:05:24 +0200	[thread overview]
Message-ID: <20190522100524.m65rnqoe3mlavmlj@salvia> (raw)
In-Reply-To: <20190522090704.145192-1-shekhar250198@gmail.com>

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@gmail.com>
> ---

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.

  reply	other threads:[~2019-05-22 10:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-22  9:07 [PATCH nft v3]tests: py: fix python3 Shekhar Sharma
2019-05-22 10:05 ` Pablo Neira Ayuso [this message]
2019-05-22 10:39 ` Shivani Bhardwaj
2019-05-23 19:39 Shekhar Sharma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190522100524.m65rnqoe3mlavmlj@salvia \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=shekhar250198@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).