Repository navigation
feat: Introduce proper py_library and py_test support in bazel rules - #1360
Conversation
These changes allow running the generated python gapic unit tests on the fly by bazel right after generation in our CI. As a result of this change some of the issues with the generated code became immediatelly visible (because now we ran the generated tests) and will be addressed separately in these issues: googleapis#1358 googleapis#1359
parthea
left a comment
There was a problem hiding this comment.
Added minor observations, otherwise LGTM
| ], | ||
| ) | ||
|
|
||
| py_test( |
There was a problem hiding this comment.
could we add a placeholder for asset as well?
# uncomment once...
#py_test(
# name = "asset_py_gapic_test",
# srcs = [
# "asset_py_gapic_pytest.py",
# "asset_py_gapic_test.py",
# ],
# legacy_create_init = False,
# deps = [
# ":asset_py_gapic",
# ],
#)
There was a problem hiding this comment.
Probably. Asset has other issues though (not that much about generator but about the wierdeness of the API itself, as it depends on many other APIs). I'll add it when fix the dependencies porition in googleapis itself (need to have explicit py_proto targets form ohter apis to specify as dependencies for asset)
|
|
||
| if __name__ == '__main__': | ||
| sys.exit(pytest.main([ | ||
| '--disable-pytest-warnings', |
There was a problem hiding this comment.
It emits a lot of garbage warnings, contaminating the output and those warnings seem to be more related to the execution environment instead of the tests themselves, so I decided to turn them off. It won't affect execution much, but it will make our log even longer (the current full build log accross whole googleapis is multple megabytes already)
These changes allow running the generated python gapic unit tests on the fly by bazel right after generation in our CI.
As a result of this change some of the issues with the generated code became immediatelly visible (because now we ran the generated tests) and will be addressed separately in these issues:
#1358
#1359
The tests can be now added in BUILD.bazel files as follows: