Skip to content
This repository was archived by the owner on Feb 17, 2026. It is now read-only.

Commit e8adc21

Browse files
committed
Code review: pass major proto version
1 parent 6d4c2eb commit e8adc21

File tree

1 file changed

+25
-12
lines changed

1 file changed

+25
-12
lines changed

noxfile.py

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -209,37 +209,50 @@ def default(session, install_grpc=True, prerelease=False, install_async_rest=Fal
209209

210210
@nox.session(python=PYTHON_VERSIONS)
211211
@nox.parametrize(
212-
["install_grpc", "install_async_rest", "python_versions", "proto4"],
212+
["install_grpc", "install_async_rest", "python_versions", "legacy_proto"],
213213
[
214-
(True, False, None, False), # Run unit tests with grpcio installed
215-
(False, False, None, False), # Run unit tests without grpcio installed
214+
(True, False, None, None), # Run unit tests with grpcio installed
215+
(False, False, None, None), # Run unit tests without grpcio installed
216216
(
217217
True,
218218
True,
219219
None,
220-
False,
220+
None,
221221
), # Run unit tests with grpcio and async rest installed
222222
# TODO: Remove once we stop support for protobuf 4.x.
223223
(
224224
True,
225225
False,
226226
["3.9", "3.10", "3.11"],
227-
True,
227+
4,
228228
), # Run proto4 tests with grpcio/grpcio-gcp installed
229229
],
230230
)
231-
def unit(session, install_grpc, install_async_rest, python_versions=None, proto4=False):
232-
"""Run the unit test suite."""
231+
def unit(
232+
session, install_grpc, install_async_rest, python_versions=None, legacy_proto=None
233+
):
234+
"""Run the unit test suite with the given configuration parameters.
235+
236+
If `python_versions` is provided, the test suite only runs when the Python version (xx.yy) is
237+
one of the values in `python_versions`.
238+
239+
If `legacy_proto` is provided, this test suite will explicitly install the proto library at
240+
that major version. Only a few values are supported at any one time; the intent is to test
241+
deprecated but noyet abandoned versions.
242+
"""
233243

234-
# TODO: Remove this code and the corresponding parameters once we stop support for protobuf 4.x.
235244
if python_versions and session.python not in python_versions:
236245
session.log(f"Skipping session for Python {session.python}")
237246
session.skip()
238247

239-
# TODO: Remove this code and the corresponding parameters once we stop support for protobuf 4.x.
240-
if proto4:
241-
# Pin protobuf to a 4.x version to ensure coverage for the legacy code path.
242-
session.install("protobuf>=4.25.8,<5.0.0")
248+
match legacy_proto:
249+
case None:
250+
pass
251+
case 4:
252+
# Pin protobuf to a 4.x version to ensure coverage for the legacy code path.
253+
session.install("protobuf>=4.25.8,<5.0.0")
254+
case _:
255+
assert False, f"Unknown legacy_proto: {legacy_proto}"
243256

244257
default(
245258
session=session,

0 commit comments

Comments
 (0)