code: def test_rwlock(tmp_path):
      path = os.fspath(tmp_path)
      foo = "foo"
  
      with rwlock(path, localfs, "cmd1", [foo], [], False):
          with pytest.raises(LockError):
              with rwlock(path, localfs, "cmd2", [], [foo], False):
                  pass
  
      with rwlock(path, localfs, "cmd1", [], [foo], False):
          with pytest.raises(LockError):
              with rwlock(path, localfs, "cmd2", [foo], [], False):
                  pass
  
      with rwlock(path, localfs, "cmd1", [], [foo], False):
          with pytest.raises(LockError):
              with rwlock(path, localfs, "cmd2", [], [foo], False):
                  pass
  
file_path: dvc/tests/unit/test_rwlock.py
imports: import json
  import os
  import pytest
  from dvc.fs import localfs
  from dvc.lock import LockError
  from dvc.rwlock import RWLockFileCorruptedError, RWLockFileFormatError, _edit_rwlock, rwlock
label_desc: Use image node_id 1 for calling a global function with example usage: test_rwlock(tmp_path) without return types