def METHOD_NAME(self, extra_work=lambda: None):
    # Emulate primary context creation by 3rd party
    the_driver = driver.driver
    if driver.USE_NV_BINDING:
        dev = driver.binding.CUdevice(0)
        hctx = the_driver.cuDevicePrimaryCtxRetain(dev)
    else:
        dev = 0
        hctx = driver.drvapi.cu_context()
        the_driver.cuDevicePrimaryCtxRetain(byref(hctx), dev)
    try:
        ctx = driver.Context(weakref.proxy(self), hctx)
        ctx.push()
        # Check that the context from numba matches the created primary
        # context.
        my_ctx = cuda.current_context()
        if driver.USE_NV_BINDING:
            self.assertEqual(int(my_ctx.handle), int(ctx.handle))
        else:
            self.assertEqual(my_ctx.handle.value, ctx.handle.value)
        extra_work()
    finally:
        ctx.pop()
        the_driver.cuDevicePrimaryCtxRelease(dev)