-
Notifications
You must be signed in to change notification settings - Fork 1.2k
tests serializing of stage to lockfile #3988
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
`key_vals` - which is list of params with values, used in a lockfile | ||
which is in the shape of: | ||
|
||
def _serialize_params_values(params: List[ParamsDependency]): |
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.
Splitted serialization of params to serializing keys and values. Was getting too complex to understand.
17b0fb9
to
86d7c13
Compare
force_grid_wrap=0 | ||
use_parentheses=True |
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.
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 I added this is because, isort adds a \
on hanging indent for imports:
from dvc.stage.serialize import \
to_single_stage_lockfile as _to_single_stage_lockfile
Whereas black formats it into this:
vs:
from dvc.stage.serialize import (
to_single_stage_lockfile as _to_single_stage_lockfile
)
class TestPathConversion(TestCase): | ||
def test(self): | ||
stage = Stage(None, "path") | ||
def test_path_conversion(dvc): |
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.
Converted to pytest format.
assert to_single_stage_lockfile(stage) == OrderedDict( | ||
[ | ||
("cmd", "command"), | ||
("deps", [OrderedDict([("path", "input"), ("md5", "md-five")])]), | ||
] | ||
) |
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.
As the order is very important for the lockfile, most of the tests use ugly OrderedDict
.
β I have followed the Contributing to DVC checklist.
π If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here. If the CLI API is changed, I have updated tab completion scripts.
β I will check DeepSource, CodeClimate, and other sanity checks below. (We consider them recommendatory and don't expect everything to be addressed. Please fix things that actually improve code or fix bugs.)
Thank you for the contribution - we'll try to review it as soon as possible. π
Part of #3693