-
Notifications
You must be signed in to change notification settings - Fork 781
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: conda/pypi user-defined attributes tracking (#2170)
- Loading branch information
Showing
4 changed files
with
71 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from metaflow.plugins.pypi.conda_decorator import CondaStepDecorator | ||
|
||
|
||
def test_decorator_custom_attributes(): | ||
deco = CondaStepDecorator(attributes={"python": "3.9"}) | ||
deco.init() | ||
assert deco.is_attribute_user_defined( | ||
"python" | ||
), "python is supposed to be an user-defined attribute" | ||
assert not deco.is_attribute_user_defined( | ||
"packages" | ||
), "packages is supposed to be default" | ||
assert not deco.is_attribute_user_defined( | ||
"libraries" | ||
), "libraries is supposed to be default" | ||
|
||
|
||
def test_decorator_custom_attributes_with_backward_compatibility(): | ||
deco = CondaStepDecorator(attributes={"libraries": {"a": "test"}}) | ||
deco.init() | ||
assert not deco.is_attribute_user_defined( | ||
"python" | ||
), "python is supposed to be default" | ||
assert deco.is_attribute_user_defined( | ||
"packages" | ||
), "packages is supposed to be user-defined" | ||
assert deco.is_attribute_user_defined( | ||
"libraries" | ||
), "libraries is supposed to be user-defined" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from metaflow.plugins.pypi.pypi_decorator import PyPIStepDecorator | ||
|
||
|
||
def test_decorator_custom_attributes(): | ||
deco = PyPIStepDecorator(attributes={"python": "3.9"}) | ||
deco.init() | ||
assert deco.is_attribute_user_defined( | ||
"python" | ||
), "python is supposed to be an user-defined attribute" | ||
assert not deco.is_attribute_user_defined( | ||
"packages" | ||
), "packages is supposed to be default" |