Re: [PATCH nft v6 1/2]tests: py: conversion to python3

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

 



On Sun, Jun 09, 2019 at 11:47:38PM +0530, Shekhar Sharma wrote:
> This patch converts the 'nft-test.py' file to run on both python 2 and python3.
> 
> Signed-off-by: Shekhar Sharma <shekhar250198@xxxxxxxxx>
> ---

A couple nits below, but otherwise

Acked-by: Eric Garver <eric@xxxxxxxxxxx>

> The version hystory of this patch is:
> v1:conversion to py3 by changing the print statements.
> v2:add 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 print statements clearer.
> v5:updated the shebang and corrected the sequence of import statements.
> v6:resent the same with small changes
> 
>  tests/py/nft-test.py | 42 ++++++++++++++++++++++--------------------
>  1 file changed, 22 insertions(+), 20 deletions(-)
> 
> diff --git a/tests/py/nft-test.py b/tests/py/nft-test.py
> index 09d00dba..4e18ae54 100755
> --- a/tests/py/nft-test.py
> +++ b/tests/py/nft-test.py
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python2
> +#!/usr/bin/python

nit: I think this shebang is more correct as it allows virtualenvs

  #!/usr/bin/env python

But we can always call the tests with an explicit interpreter

  # .../my/bin/python ./nft-test.py

>  #
>  # (C) 2014 by Ana Rey Botello <anarey@xxxxxxxxx>
>  #
[..]
> @@ -1358,6 +1359,10 @@ def main():
>      parser.add_argument('-s', '--schema', action='store_true',
>                          dest='enable_schema',
>                          help='verify json input/output against schema')
> +	

nit: This adds a line with a tab, which both git-am and flake8 complain
about.

> +    parser.add_argument('-v', '--version', action='version',
> +                        version='1.0',
> +                        help='print the version information')
>  
>      args = parser.parse_args()
>      global debug_option, need_fix_option, enable_json_option, enable_json_schema
> @@ -1372,15 +1377,15 @@ def main():
[..]



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

  Powered by Linux