Skip to content

Commit

Permalink
test: fix test related to path on windows
Browse files Browse the repository at this point in the history
On windows, `str(exc_info)` is returning escaped path, eg:
'<ExceptionInfo UrlNotDvcRepoError("URL \'C:\\\\Users\\\\travis\\\\AppData\\\\Local\\\\Temp\\\\pytest-of-travis\\\\pytest-0\\\\popen-gw2\\\\test_get_url_git_only_repo_thr0\' is not a dvc repository.") tblen=2>'

This commit just replaces the double slashes with single one. Bit of a hack, I know.
  • Loading branch information
skshetry committed Jan 16, 2020
1 parent aa7119a commit 50206d4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/func/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ def test_get_url_git_only_repo_throws_exception(tmp_dir, scm):
with pytest.raises(UrlNotDvcRepoError) as exc_info:
api.get_url("foo", fspath(tmp_dir))

assert fspath(tmp_dir) in str(exc_info)
# On windows, `exc_info` has path escaped, eg: `C:\\\\Users\\\\travis`
assert fspath(tmp_dir) in str(exc_info).replace("\\\\", "\\")


@pytest.mark.parametrize("remote_url", all_remote_params, indirect=True)
Expand Down

0 comments on commit 50206d4

Please sign in to comment.