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

In tests, explore creating descriptors from strings rather than helper functions to improve readability #1986

Open
parthea opened this issue Mar 19, 2024 · 0 comments
Labels
type: cleanup An internal cleanup or hygiene concern.

Comments

@parthea
Copy link
Contributor

parthea commented Mar 19, 2024

From #1975 (comment) in PR #1975,

See suggestion below to improve readability of tests that require building descriptors from protos.

If it's trivial to read from a proto "file" (string) in tests, it might be simpler to simply encode the protofile inline rather than calling make_file_pb2

Something like this

proto_descriptor = make_protodescriptor("""
package xx;

message Foo { 
  string foo = 1;
}
""")

instead of

    fd = (
        make_file_pb2(
            name="someexample.proto",
            package="google.example.v1beta1",
            messages=(
                make_message_pb2(name="ExampleRequest", fields=fields),
                make_message_pb2(name="ExampleResponse", fields=()),
            ),
            services=(
                descriptor_pb2.ServiceDescriptorProto(
                    name="SomeExample",

would improve readability

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: cleanup An internal cleanup or hygiene concern.
Projects
None yet
Development

No branches or pull requests

1 participant