From 401d0933e63f81c784c45c2cd8328bd1e4807712 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Tue, 22 Jan 2013 21:18:30 -0500
Subject: [PATCH] Some test fixes/loosened error bounds.

---
 test/test_algorithm.py | 28 +++++++++-------------------
 test/test_clmath.py    |  4 ++--
 2 files changed, 11 insertions(+), 21 deletions(-)

diff --git a/test/test_algorithm.py b/test/test_algorithm.py
index 0f7563c6..0022c6a0 100644
--- a/test/test_algorithm.py
+++ b/test/test_algorithm.py
@@ -29,21 +29,12 @@ import pytools.test
 from pytools import memoize
 from test_array import general_clrand
 
-
-def have_cl():
-    try:
-        import pyopencl
-        return True
-    except:
-        return False
-
-if have_cl():
-    import pyopencl as cl
-    import pyopencl.array as cl_array
-    import pyopencl.tools as cl_tools
-    from pyopencl.tools import pytest_generate_tests_for_pyopencl \
-            as pytest_generate_tests
-    from pyopencl.characterize import has_double_support
+import pyopencl as cl
+import pyopencl.array as cl_array
+import pyopencl.tools as cl_tools
+from pyopencl.tools import pytest_generate_tests_for_pyopencl \
+        as pytest_generate_tests
+from pyopencl.characterize import has_double_support
 
 
 
@@ -579,6 +570,9 @@ def test_partition(ctx_factory):
 
 @pytools.test.mark_test.opencl
 def test_unique(ctx_factory):
+    from pytest import importorskip
+    importorskip("mako")
+
     context = ctx_factory()
     queue = cl.CommandQueue(context)
 
@@ -835,10 +829,6 @@ def test_key_value_sorter(ctx_factory):
 
 
 if __name__ == "__main__":
-    # make sure that import failures get reported, instead of skipping the
-    # tests.
-    import pyopencl as cl
-
     import sys
     if len(sys.argv) > 1:
         exec(sys.argv[1])
diff --git a/test/test_clmath.py b/test/test_clmath.py
index e502b051..4eb8ea46 100644
--- a/test/test_clmath.py
+++ b/test/test_clmath.py
@@ -118,8 +118,8 @@ if have_cl():
     test_cos = make_unary_function_test("cos", (-10, 10), 2e-7, use_complex=2e-2)
     test_asin = make_unary_function_test("asin", (-0.9, 0.9), 5e-7)
     test_acos = make_unary_function_test("acos", (-0.9, 0.9), 5e-7)
-    test_tan = make_unary_function_test("tan", 
-            (-math.pi/2 + 0.1, math.pi/2 - 0.1), 2e-5, use_complex=True)
+    test_tan = make_unary_function_test("tan",
+            (-math.pi/2 + 0.1, math.pi/2 - 0.1), 4e-5, use_complex=True)
     test_atan = make_unary_function_test("atan", (-10, 10), 2e-7)
 
     test_sinh = make_unary_function_test("sinh", (-3, 3), 2e-6, use_complex=2e-3)
-- 
GitLab