diff --git a/test/test_algorithm.py b/test/test_algorithm.py
index 0f7563c695307dfff23dcb2bfeff2b9caed0ebce..0022c6a07e1446fd4d30433718bdfda1ef6edb2e 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 e502b0514c8458c94b88faf75b80e4fa5260a888..4eb8ea46d2ae1551e7e44c4313e5694357e0be36 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)