diff --git a/pyopencl/tools.py b/pyopencl/tools.py
index a124600f85fc5c0a9d64e794ecfd64afd887f8f7..e9a6665ca3747a117dd09b669074100f695e5a06 100644
--- a/pyopencl/tools.py
+++ b/pyopencl/tools.py
@@ -78,10 +78,11 @@ def pytest_generate_tests_for_pyopencl(metafunc):
             from gc import collect
             collect()
 
-            return cl.Context([device])
+            return cl.Context([self.device])
 
         def __str__(self):
             return "<context getter for %s>" % self.device
+
     if ("device" in metafunc.funcargnames
             or "ctx_getter" in metafunc.funcargnames):
         arg_dict = {}