diff --git a/pystencils_tests/test_opencl.py b/pystencils_tests/test_opencl.py
index 5216d52f8da903dad81c2f3041a202861c31f0f6..dfeab790a1129852cc3ac60bdff72cba04015964 100644
--- a/pystencils_tests/test_opencl.py
+++ b/pystencils_tests/test_opencl.py
@@ -1,5 +1,5 @@
 import numpy as np
-import pyopencl as cl
+import pytest
 import sympy as sp
 
 import pystencils
@@ -7,6 +7,12 @@ from pystencils.backends.cuda_backend import CudaBackend
 from pystencils.backends.opencl_backend import OpenClBackend
 from pystencils.opencl.opencljit import make_python_function
 
+try:
+    import pyopencl as cl
+    HAS_OPENCL = True
+except Exception:
+    HAS_OPENCL = False
+
 
 def test_print_opencl():
     z, y, x = pystencils.fields("z, y, x: [2d]")
@@ -32,6 +38,7 @@ def test_print_opencl():
     assert "get_local_id(0)" in str(opencl_code)
 
 
+@pytest.mark.skipif(not HAS_OPENCL, reason="Test requires pyopencl")
 def test_opencl_jit():
     z, y, x = pystencils.fields("z, y, x: [20,30]")