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

baker.dylan.c at gmail.com baker.dylan.c at gmail.com
Wed Nov 11 15:02:14 PST 2015


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.

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],
-- 
2.6.2



More information about the Piglit mailing list