def METHOD_NAME(ds_generator):
    deeplake.constants.LOCKS_ENABLED = True
    try:
        orig_ds = ds_generator()
        orig_ds.create_tensor("x")
        arr = np.random.random((32, 32))
        orig_ds.x.append(arr)
        with VM():
            # Make sure read only warning is raised
            with pytest.warns(UserWarning):
                ds = ds_generator()
                np.testing.assert_array_equal(arr, ds.x[0].numpy())
            assert ds.read_only == True
            with pytest.raises(LockedException):
                ds.read_only = False
            # Raise error if user explicitly asks for write access
            with pytest.raises(LockedException):
                ds = ds_generator(read_only=False)
            # No warnings if user requests read only mode
            with warnings.catch_warnings(record=True) as ws:
                ds = ds_generator(read_only=True)
                np.testing.assert_array_equal(arr, ds.x[0].numpy())
            assert not ws
    finally:
        lock.unlock_dataset(orig_ds)
        deeplake.constants.LOCKS_ENABLED = False