Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dvc: do not set cache dir if it's not a dvc repo #3329

Merged
merged 1 commit into from
Feb 14, 2020

Conversation

skshetry
Copy link
Member

  • ❗ Have you followed the guidelines in the Contributing to DVC list?

  • πŸ“– Check this box if this PR does not require documentation updates, or if it does and you have created a separate PR in dvc.org with such updates (or at least opened an issue about it in that repo). Please link below to your PR (or issue) in the dvc.org repo.

  • ❌ Have you checked DeepSource, CodeClimate, and other sanity checks below? We consider their findings recommendatory and don't expect everything to be addressed. Please review them carefully and fix those that actually improve code or fix bugs.

Thank you for the contribution - we'll try to review it as soon as possible. πŸ™

Fixes #3328

@skshetry skshetry requested review from Suor and efiop February 14, 2020 15:31
@skshetry skshetry self-assigned this Feb 14, 2020
dvc/config.py Outdated Show resolved Hide resolved
dvc/config.py Show resolved Hide resolved
@skshetry skshetry force-pushed the fix-non-dvc-repo-error branch from 64ad07c to cc020fc Compare February 14, 2020 16:15
@skshetry
Copy link
Member Author

skshetry commented Feb 14, 2020

Let's fail with the test for now. After it fails, I'll fix a push in another commit.

@skshetry
Copy link
Member Author

Failed nicely. CI log:

=================================== FAILURES ===================================
_______________ test_config_loads_without_error_for_non_dvc_repo _______________
[gw3] linux -- Python 3.7.1 /home/travis/virtualenv/python3.7.1/bin/python
tmp_dir = PosixTmpDir('/tmp/pytest-of-travis/pytest-0/popen-gw3/test_config_loads_without_erro0')
    def test_config_loads_without_error_for_non_dvc_repo(tmp_dir):
        # regression testing for https://github.com/iterative/dvc/issues/3328
>       Config(validate=True)
/home/travis/build/iterative/dvc/tests/func/test_config.py:108: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/travis/build/iterative/dvc/dvc/config.py:223: in __init__
    self.load(validate=validate)
/home/travis/build/iterative/dvc/dvc/config.py:282: in load
    self["cache"]["dir"] = os.path.join(self.dvc_dir, "cache")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
a = None, p = ('cache',)
    def join(a, *p):
        """Join two or more pathname components, inserting '/' as needed.
        If any component is an absolute path, all previous path components
        will be discarded.  An empty last part will result in a path that
        ends with a separator."""
>       a = os.fspath(a)
E       TypeError: expected str, bytes or os.PathLike object, not NoneType
/home/travis/virtualenv/python3.7.1/lib/python3.7/posixpath.py:80: TypeError
_______________ test_plain_dvc_command_not_fail_on_non_dvc_repo ________________
[gw1] linux -- Python 3.7.1 /home/travis/virtualenv/python3.7.1/bin/python
tmp_dir = PosixTmpDir('/tmp/pytest-of-travis/pytest-0/popen-gw1/test_plain_dvc_command_not_fai0')
git_dir = PosixTmpDir('/tmp/pytest-of-travis/pytest-0/popen-gw1/git-erepo0')
    def test_plain_dvc_command_not_fail_on_non_dvc_repo(tmp_dir, git_dir):
        # regression test for https://github.com/iterative/dvc/issues/3328
>       assert main([]) == 0
E       assert 254 == 0
E         -254
E         +0

/home/travis/build/iterative/dvc/tests/func/test_cli.py:184: AssertionError

@skshetry skshetry force-pushed the fix-non-dvc-repo-error branch from 6f4e2ee to 25f33e4 Compare February 14, 2020 16:43
@efiop efiop merged commit 77f24af into iterative:master Feb 14, 2020
@skshetry skshetry deleted the fix-non-dvc-repo-error branch February 14, 2020 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dvc commands fail on non-DVC repository with an exception
2 participants