def METHOD_NAME(tmp_path):
    path = os.fspath(tmp_path)
    foo = "foo"
    subfoo = os.path.join("foo", "subfoo")
    with rwlock(path, localfs, "cmd1", [foo], [], False):
        with pytest.raises(LockError, match=r"subfoo(.|\n)*cmd1"):
            with rwlock(path, localfs, "cmd2", [], [subfoo], False):
                pass
    with rwlock(path, localfs, "cmd1", [], [subfoo], False):
        with pytest.raises(LockError, match=r"'foo'(.|\n)*cmd1"):
            with rwlock(path, localfs, "cmd2", [foo], [], False):
                pass
    with rwlock(path, localfs, "cmd1", [], [subfoo], False):
        with pytest.raises(LockError):
            with rwlock(path, localfs, "cmd2", [], [foo], False):
                pass
    with rwlock(path, localfs, "cmd1", [subfoo], [], False):
        with rwlock(path, localfs, "cmd2", [foo], [], False):
            pass