Skip to content

Commit

Permalink
lock: added troubleshooting doc link in error message (iterative#4325)
Browse files Browse the repository at this point in the history
  • Loading branch information
harsh8398 committed Oct 14, 2020
1 parent f0a729d commit b8fa3df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 5 additions & 3 deletions dvc/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@

DEFAULT_TIMEOUT = 3


FAILED_TO_LOCK_MESSAGE = (
"cannot perform the command because another DVC process seems to be "
"running on this project. If that is not the case, manually remove "
"`.dvc/tmp/lock` and try again."
"Unable to acquire lock. Most likely another DVC process is running or "
"was terminated abruptly. Check the page {}."
).format(
format_link("https://dvc.org/doc/user-guide/troubleshooting#lock-issue")
)


Expand Down
9 changes: 7 additions & 2 deletions tests/func/test_lock.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from dvc.lock import FAILED_TO_LOCK_MESSAGE, Lock, LockError
from dvc.lock import Lock, LockError
from dvc.main import main


Expand All @@ -18,6 +18,11 @@ def test_cli(tmp_dir, dvc, mocker, caplog):
# patching to speedup tests
mocker.patch("dvc.lock.DEFAULT_TIMEOUT", 0.01)

expected_error_msg = (
"Unable to acquire lock. Most likely another DVC process is "
"running or was terminated abruptly. Check the page "
"<https://dvc.org/doc/user-guide/troubleshooting#lock-issue>."
)
with Lock(tmp_dir / dvc.tmp_dir / "lock"):
assert main(["add", "foo"]) == 1
assert FAILED_TO_LOCK_MESSAGE in caplog.text
assert expected_error_msg in caplog.text

0 comments on commit b8fa3df

Please sign in to comment.