Re: [PATCH iptables v1] iptables-test: fix python3

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

 



On Wed, Jun 12, 2019 at 12:29 AM Eric Garver <eric@xxxxxxxxxxx> wrote:
>
> On Fri, Jun 07, 2019 at 01:20:58AM +0530, Shekhar Sharma wrote:
> > This patch converts the 'iptables-test.py' file (iptables/iptables-test.py) to run on
> > both python 2 and python3.
> >
> >
> > Signed-off-by: Shekhar Sharma <shekhar250198@xxxxxxxxx>
> > ---
> >  iptables-test.py | 43 ++++++++++++++++++++++---------------------
> >  1 file changed, 22 insertions(+), 21 deletions(-)
> >
> > diff --git a/On Sun, Jun 09, 2019 at 11:48:49PM +0530, Shekhar Sharma wrote:
> This patch adds the netns feature to the 'nft-test.py' file.
>
> Signed-off-by: Shekhar Sharma <shekhar250198@xxxxxxxxx>
> ---
> The version history of the patch is :
> v1: add the netns feature
> v2: use format() method to simplify print statements.
> v3: updated the shebang
> v4: resent the same with small changes
>
>  tests/py/nft-test.py | 98 ++++++++++++++++++++++++++++++++++++--------
>  1 file changed, 80 insertions(+), 18 deletions(-)
>
> diff --git a/tests/py/nft-test.py b/tests/py/nft-test.py
> index 4e18ae54..c9f65dc5 100755
> --- a/tests/py/nft-test.py
> +++ b/tests/py/nft-test.py
[..]
iptables-test.py b/iptables-test.py
> > index 532dee7..8018b65 100755
> > --- a/iptables-test.py
> > +++ b/iptables-test.py
> [..]
> > @@ -79,7 +80,7 @@ def run_test(iptables, rule, rule_save, res, filename, lineno, netns):
> >
> >      cmd = iptables + " -A " + rule
> >      if netns:
> > -            cmd = "ip netns exec ____iptables-container-test " + EXECUTEABLE + " " + cmd
> > +            cmd = "ip netns exec ____iptables-container-test " + EXECUTEABLE + "  {}".format(cmd)
>
> This is a bogus change. No reason to switch to format() when we're just
> concatenating strings. Many occurrences of this in the patch.
>
> I think you only need to fix the print statements.
>

Okay, i will change it and resend the patch.
> >
> >      ret = execute_cmd(cmd, filename, lineno)
> >
> [..]
> > @@ -365,9 +366,9 @@ def main():
> >              passed += file_passed
> >              test_files += 1
> >
> > -    print ("%d test files, %d unit tests, %d passed" %
> > -           (test_files, tests, passed))
> > +    print("{} test files, {} unit tests, {} passed".format(test_files, tests, passed))
> >
> >
> >  if __name__ == '__main__':
> >      main()
> > +
>
> Bogus new line.

Should i change the shebang to this here as well?
#!/usr/bin/env python


Thanks!
Shekhar



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

  Powered by Linux