[Piglit] [PATCH] generated_tests/builtin_function.py: fix running with python 3.x

Jan Vesely jan.vesely at rutgers.edu
Wed Nov 11 18:33:21 PST 2015


On Wed, 2015-11-11 at 15:02 -0800, baker.dylan.c at gmail.com wrote:
> From: Dylan Baker <baker.dylan.c at gmail.com>
> 
> The current code works under python 2.7, but not python 3.x. This
> patch
> corrects that by making the code work for both.

Fixes the build for me.
Tested-by: Jan Vesely <jan.vesely at rutgers.edu>

> 
> Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
> ---
>  generated_tests/builtin_function.py | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/generated_tests/builtin_function.py
> b/generated_tests/builtin_function.py
> index 40ef70f..b587851 100644
> --- a/generated_tests/builtin_function.py
> +++ b/generated_tests/builtin_function.py
> @@ -1281,7 +1281,8 @@ def
> _make_vector_or_matrix_test_vectors(test_suite_dict):
>         floats+vecs+mats+ints+ivecs+uints+uvecs],
>        template='{0};\n  result += {1}')
>      # This can generate an overflow warning, this is expected
> -    with warnings.catch_warnings(RuntimeWarning):
> +    with warnings.catch_warnings():
> +        warnings.simplefilter('ignore', RuntimeWarning)
>          f('op-assign-sub', 2, 110,
>            lambda x, y: x - y, match_assignment_operators,
>            [floats+vecs+mats+ints+ivecs+uints+uvecs,
> @@ -1326,7 +1327,8 @@ def
> _make_vector_or_matrix_test_vectors(test_suite_dict):
>         floats+vecs+mats+ints+ivecs+uints+uvecs],
>        template='({0} + {1})')
>      # This can generate an overflow warning, this is expected
> -    with warnings.catch_warnings(RuntimeWarning):
> +    with warnings.catch_warnings():
> +        warnings.simplefilter('ignore', RuntimeWarning)
>          f('op-sub', 2, 110, lambda x, y: x - y, match_simple_binop,
>            [floats+vecs+mats+ints+ivecs+uints+uvecs,
>             floats+vecs+mats+ints+ivecs+uints+uvecs],
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20151111/c317a1eb/attachment.sig>


More information about the Piglit mailing list