-
Notifications
You must be signed in to change notification settings - Fork 229
Import wellknown types (fixes #9) #76
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
Closed
boukeversteegh
wants to merge
3
commits into
danielgtaylor:master
from
boukeversteegh:pr/import-wellknown-types
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
11 changes: 0 additions & 11 deletions
11
...to/tests/inputs/googletypes_service_returns_empty/googletypes_service_returns_empty.proto
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
...nputs/googletypes_service_returns_googletype/googletypes_service_returns_googletype.proto
This file contains hidden or 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,14 @@ | ||
syntax = "proto3"; | ||
|
||
import "google/protobuf/empty.proto"; | ||
import "google/protobuf/struct.proto"; | ||
|
||
service Test { | ||
rpc GetEmpty (RequestMessage) returns (google.protobuf.Empty); | ||
rpc GetStruct (RequestMessage) returns (google.protobuf.Struct); | ||
rpc GetListValue (RequestMessage) returns (google.protobuf.ListValue); | ||
rpc GetValue (RequestMessage) returns (google.protobuf.Value); | ||
} | ||
|
||
message RequestMessage { | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
is this sufficient for it to get included in the test run?
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.
yup~ :-D
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.
It will get included in the test run, meaning that the service will be instantiated.
actually, whether that's a sufficient test is another thing..
i have tested in a separate unit test that the import statements are generated correctly, but i'm having problems running it in the same go with the other tests.
the datadescriptor pool from google protobuf is filled twice with the same protobufs, for some reason. if i run the test separately, it works, but not together with the other tests.
i know from fixing #40 that returning the google-compiled wellknown value works, as long as its imported, so i think this will be good, but i haven't done a manual end-to-end-test
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.
the test i have problems with, and haven't committed, is this one:
betterproto/tests/test_get_ref_type.py
When running all tests, this error is raised by google protobuf lib
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.
Hmm, weird. It would be preferable to have full functional coverage, even if as a stopgap we have to mark it as a test that has to be run in isolation, so isn't included in the main test run. What do you think?
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.
yeah i would also prefer full coverage!
we could also concider to isolate the
test_binary_compatibility
instead, because that's the one causing problems (probably because of libmodule.import), as i'm expecting we'll need more unit tests that importplugin.py
, and each of them will conflict withtest_binary_compatibility
we can update the CI to run both test sets separately
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.
any idea how to mark the tests?
we could probably add groups/tags or something, but it does mean that contributors will need to know to run these tests separately.
would be great if we could let the standard
pytest
command run without problems 🤔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.
Maybe worthwhile to make the input test loading a bit more sophisticated to handle this stuff more smoothly.
I'm thinking instead of expecting there to be a module member called
Test
, make it scan the members and import anything that starts withTest
. Should be easy?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 for marking the tests as separate test runs (requiring separate python runtimes), there might be a pytest feature or plugin to handle this otherwise having a test task (pipenv script, make target or wtv) that does the right tging should cover it. Though maybe solving the naming problem with smarter import logic makes the problem go away?
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.
That could work, and i would like it to support Test* messages instead of mandatory names..
although using it as the only fix for this conflict, would make it mandatory that all proto messages have unique names... would be nice if we can avoid that