-
Notifications
You must be signed in to change notification settings - Fork 1.2k
import: test: refactor to dir helpers #2935
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
|
@pared Tests are failing. |
tests/func/test_import.py
Outdated
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.
We should be there already. If we are not then this is a bug in erepo_dir probably.
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.
erepo_dir is fixed here #2938, not merged yet.
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 is merged now.
tests/func/test_import.py
Outdated
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.
Let's simply use literals and fspath() not str():
dvc.imp(fspath(erepo_dir), "foo", "foo_imported")
tests/func/test_import.py
Outdated
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.
assert os.path.isfile("foo_imported") should be enough, we don't need both.
tests/func/test_import.py
Outdated
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.
If we really want to check foo contents then it might be easier/more obvious to check text itself:
assert (tmp_dir / "foo").read_text() == "foo text" I am fine both ways though.
tests/func/test_import.py
Outdated
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.
assert (tmp_dir / "version").read_text() == "branch"Also why do we need .exists() and .isfile() check?
tests/func/test_import.py
Outdated
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.
Why do you create new Repo while previously test used .dvc?
tests/func/test_import.py
Outdated
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.
erepo_dir.scm_add([...], commit="use symlinks")
tests/func/test_import.py
Outdated
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 can use scm directly, you also can use tmp_dir.scm_add(..., commit=...)
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.
@Suor leaved pretty good comments, nothing to add, but please address them
|
@pared did you forget about this one? |
|
@Suor |
|
@pared use : with monkeypatch.context() as m:
m.chdir(erepo_dir)
erepo_dir.dvc_gen(...)for now. I will think how to make it easier later. |
|
@pared Tests are failing. |
|
@pared Tests are still failing |
|
For the record: mac pkg test is failing due to unrelated reasons. @pared Need to rebase though π |
| m.chdir(fspath(erepo_dir)) | ||
| erepo_dir.dvc_gen("foo", "master content", commit="create foo") | ||
| erepo_dir.scm.checkout("new_branch", create_new=True) | ||
| erepo_dir.dvc_gen("foo", "branch content", commit="modify foo") |
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 is a bit complicated bootstrapping. We will need to come up with something better.
β 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. π