Skip to content
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

chore: add default library settings #2120

Merged
merged 2 commits into from
Aug 30, 2024
Merged

chore: add default library settings #2120

merged 2 commits into from
Aug 30, 2024

Conversation

parthea
Copy link
Contributor

@parthea parthea commented Aug 30, 2024

This PR adds default library settings for the proto package being generated to avoid KeyError when looking up the python specific settings.

Without this fix test test_read_empty_python_settings_from_service_yaml fails with the error below:

________________________________________________________________________________________ test_read_empty_python_settings_from_service_yaml ________________________________________________________________________________________

    def test_read_empty_python_settings_from_service_yaml():
        service_yaml_config = {
            "apis": [
                {"name": "google.example.v1beta1.ServiceOne.Example1"},
            ],
        }
        cli_options = Options(service_yaml_config=service_yaml_config)
        fd = get_file_descriptor_proto_for_tests(fields=[])
        api_schema = api.API.build(fd, "google.example.v1beta1", opts=cli_options)
>       assert api_schema.all_library_settings["google.example.v1beta1"].python_settings \
            == client_pb2.PythonSettings()
E       KeyError: 'google.example.v1beta1'

tests/unit/schema/test_api.py:2738: KeyError

@product-auto-label product-auto-label bot added the size: s Pull request size is small. label Aug 30, 2024
@parthea parthea added the owlbot:run Add this label to trigger the Owlbot post processor. label Aug 30, 2024
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Aug 30, 2024
@parthea parthea marked this pull request as ready for review August 30, 2024 16:02
@parthea parthea requested a review from a team as a code owner August 30, 2024 16:02
@parthea parthea assigned ohmayr and unassigned vchudnov-g Aug 30, 2024
@@ -2737,6 +2737,10 @@ def test_read_empty_python_settings_from_service_yaml():
api_schema = api.API.build(fd, "google.example.v1beta1", opts=cli_options)
assert api_schema.all_library_settings["google.example.v1beta1"].python_settings \
== client_pb2.PythonSettings()
assert api_schema.all_library_settings["google.example.v1beta1"].python_settings.experimental_features \
== client_pb2.PythonSettings.ExperimentalFeatures()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you link me to this property in client_pb2 file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ohmayr ohmayr merged commit bfd4825 into main Aug 30, 2024
67 checks passed
@ohmayr ohmayr deleted the add-default-settings branch August 30, 2024 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants