code: def test_unlock_lock_failed(tmp_dir, dvc, request, mocker):
      # patching to speedup tests
      mocker.patch("dvc.lock.DEFAULT_TIMEOUT", 0.01)
  
      lockfile = tmp_dir / dvc.tmp_dir / "lock"
      lock = Lock(lockfile)
      lock_ext = Lock(lockfile)
  
      # It's a common scenario now to have lock unlocked and locked back (e.g. in
      # repro of a stage) in with. We should see LockError exception here.
      with lock:
          lock.unlock()
          lock_ext.lock()  # imitate an external process had time to lock it
          request.addfinalizer(lock_ext.unlock)
          with pytest.raises(LockError):
              lock.lock()
  
file_path: dvc/tests/func/test_lock.py
imports: import pytest
  from dvc.cli import main
  from dvc.exceptions import DvcException
  from dvc.lock import Lock, LockError
label_desc: Use image node_id 2 for calling a global function with example usage: test_unlock_lock_failed(tmp_dir, dvc, request, mocker) without return types