-
Notifications
You must be signed in to change notification settings - Fork 1.2k
remote: verify repository exists when level requires it #3194
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
Conversation
tests/func/test_remote.py
Outdated
| ], | ||
| ) | ||
| def test_commands_outside_dvc_repository(tmp_dir, cmd): | ||
| assert 253 == main(cmd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
253 is returned when NotDvcRepoError is raised.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This issue is relevant for dvc config in general and should be fixed there instead. dvc_dir defaults to None and so https://github.com/iterative/dvc/blob/master/dvc/config.py#L261 loads empty configs with filename == None, adjusts them and then doesn't save them because of filename == None. Need a general approach here.
| COMPILED_SCHEMA = Schema(SCHEMA) | ||
|
|
||
| def __init__(self, dvc_dir=None, validate=True): | ||
| def __init__(self, dvc_dir=None, validate=True, verify_repo=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a new parameter because I didn't want to mess up with any previous logic dealing with having an empty dvc_dir.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MrOutis This looks like a hack rather than a proper solution 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@efiop, could you explain? Not sure how to proceed with such observation 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are hacking your way through the bug instead of solving the bug. This verify_repo shouldn't be an option at all. Config should always raise if you try to modify in-repo config when there isn't one.
tests/func/test_remote.py
Outdated
| remote_config.modify("myremote", "gdrive_client_id", "xxx") | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solution is for config in general, but tests are for remote specifically, not nice 🙂Also not clear why are you testing CLI again and not API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, that's a left over. Those tests are not relevant since they were replaced for the ones in test_config.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙈 I got confused with the other pull-request:
https://github.com/iterative/dvc/pull/3193/files#diff-dcfb923229ccfbba150bdd77494f46eeR96-R97
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer testing the CLI in this case, it is more complete, but if you want, I use the API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MrOutis CLI is a dumb wrapper for API. We always test API, so let's do the same here. If you want to check that CLI returns proper codes on corresponding exceptions, just add a unit test to tests/unit/command/.
|
Ok, looks like there is no good quick and neat way to solve it, it will look like a hack in any case. What we need here is a redesign. 🙁 |
|
Closing for now, this will require a config redesign first. |
Close #2309