| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
This pull request implements the prerelease_deps session in noxfile.py to run generated unit tests against pre-release ecosystem dependencies. The feedback suggests using importlib.metadata to retrieve package versions more robustly without importing the packages directly, and replacing the deprecated py.test command with pytest.
Sorry, something went wrong.
| package_namespaces = { | ||
| "google-api-core": "google.api_core", | ||
| "google-auth": "google.auth", | ||
| "grpcio": "grpc", | ||
| "protobuf": "google.protobuf", | ||
| "proto-plus": "proto", | ||
| } | ||
| for pkg, namespace in package_namespaces.items(): | ||
| session.run( | ||
| "python", | ||
| "-c", | ||
| f"import {namespace}; print('{pkg}:', {namespace}.__version__)", | ||
| silent=False, | ||
| ) | ||
|
|
There was a problem hiding this comment.
Using importlib.metadata is a more robust and standard way to retrieve installed package versions. It avoids importing the packages directly (which can trigger deprecation warnings or initialization side-effects) and eliminates the need to map package names to their internal import namespaces.
| package_namespaces = { | |
| "google-api-core": "google.api_core", | |
| "google-auth": "google.auth", | |
| "grpcio": "grpc", | |
| "protobuf": "google.protobuf", | |
| "proto-plus": "proto", | |
| } | |
| for pkg, namespace in package_namespaces.items(): | |
| session.run( | |
| "python", | |
| "-c", | |
| f"import {namespace}; print('{pkg}:', {namespace}.__version__)", | |
| silent=False, | |
| ) | |
| # 3. Print out the versions to mimic the downstream logging verification | |
| packages = [ | |
| "google-api-core", | |
| "google-auth", | |
| "grpcio", | |
| "protobuf", | |
| "proto-plus", | |
| ] | |
| for pkg in packages: | |
| session.run( | |
| "python", | |
| "-c", | |
| f"import importlib.metadata; print('{pkg}:', importlib.metadata.version('{pkg}'))", | |
| ) |
Sorry, something went wrong.
| # 4. Run the hermetic unit tests with the specific protobuf backend | ||
| session.run( | ||
| "py.test", | ||
| "tests/unit", | ||
| env={ | ||
| "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, | ||
| }, | ||
| ) |
There was a problem hiding this comment.
Use pytest instead of the deprecated py.test entry point to run the unit tests.
| # 4. Run the hermetic unit tests with the specific protobuf backend | |
| session.run( | |
| "py.test", | |
| "tests/unit", | |
| env={ | |
| "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, | |
| }, | |
| ) | |
| # 4. Run the hermetic unit tests with the specific protobuf backend | |
| session.run( | |
| "pytest", | |
| "tests/unit", | |
| env={ | |
| "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, | |
| }, | |
| ) |
Sorry, something went wrong.
|
Closing as this appears to be obsolete |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
wip