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

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

 



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/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.

>  
>      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.



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

  Powered by Linux