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
[codegen/python] fix deprecation warning on default values #13890
Conversation
Changelog[uncommitted] (2023-09-12)Bug Fixes
|
64e4d26
to
93a3a23
Compare
""" | ||
new_resource mocks resource construction calls. This function should return the physical identifier and the output properties | ||
for the resource being constructed. | ||
|
||
:param MockResourceArgs args. | ||
""" |
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.
""" | |
new_resource mocks resource construction calls. This function should return the physical identifier and the output properties | |
for the resource being constructed. | |
:param MockResourceArgs args. | |
""" |
No need for doc comments about the abstract method in test code.
@pulumi.runtime.test | ||
def test_func_with_default_value(my_mocks): | ||
with patch("warnings.warn") as mock_warn: | ||
pulumi_plant.tree.v1.RubberTree("my-tree", pulumi_plant.tree.v1.RubberTreeArgs()) |
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.
Wasn't totally obvious what this was testing to start, I would add a doc comment to this method saying what we're doing "constructing a resource with deprecated but default values and checking the default values don't trigger a deprecation warning"
18463bf
to
f2df766
Compare
Removes Resource constructor deprecation checks in favor of deprecation checks in the ResourceArgs constructor. The Resource constructor would always see the default value as set and would trigger deprecation warnings if they exist. Fixes #12546
f2df766
to
0244db0
Compare
Description
Removes Resource constructor deprecation checks in favor of deprecation checks in the ResourceArgs constructor.
Checks in the ResourceArgs constructor which will be changed to
ResourceArgs.__configure__
in #13825 and compatible with dicts and objects that implement__getitem__
__setitem__
.Merge #13825 after and update
__internal_init__
logic to use theResourceArgs.__configure__
Fixes #12546
Checklist
make tidy
to update any new dependenciesmake lint
to verify my code passes the lint checkgofumpt
make changelog
and committed thechangelog/pending/<file>
documenting my change