@@ -215,46 +215,41 @@ def default(session, install_grpc=True, prerelease=False, install_async_rest=Fal
215215
216216
217217@nox .session (python = PYTHON_VERSIONS )
218- def unit (session ):
218+ @nox .parametrize (
219+ ["install_grpc_gcp" , "install_grpc" , "install_async_rest" ],
220+ [
221+ (False , True , False ), # Run unit tests with grpcio installed
222+ (True , True , False ), # Run unit tests with grpcio/grpcio-gcp installed
223+ (False , False , False ), # Run unit tests without grpcio installed
224+ (False , True , True ), # Run unit tests with grpcio and async rest installed
225+ ],
226+ )
227+ def unit (session , install_grpc_gcp , install_grpc , install_async_rest ):
219228 """Run the unit test suite."""
220- default (session )
221229
222-
223- @nox .session (python = PYTHON_VERSIONS )
224- def unit_w_prerelease_deps (session ):
225- """Run the unit test suite."""
226- default (session , prerelease = True )
227-
228-
229- @nox .session (python = PYTHON_VERSIONS )
230- def unit_grpc_gcp (session ):
231- """
232- Run the unit test suite with grpcio-gcp installed.
233- `grpcio-gcp` doesn't support protobuf 4+.
234- Remove extra `grpcgcp` when protobuf 3.x is dropped.
235- https://github.com/googleapis/python-api-core/issues/594
236- """
237- constraints_path = str (
238- CURRENT_DIRECTORY / "testing" / f"constraints-{ session .python } .txt"
230+ # `grpcio-gcp` doesn't support protobuf 4+.
231+ # Remove extra `grpcgcp` when protobuf 3.x is dropped.
232+ # https://github.com/googleapis/python-api-core/issues/594
233+ if install_grpc_gcp :
234+ constraints_path = str (
235+ CURRENT_DIRECTORY / "testing" / f"constraints-{ session .python } .txt"
236+ )
237+ # Install grpcio-gcp
238+ session .install ("-e" , ".[grpcgcp]" , "-c" , constraints_path )
239+ # Install protobuf < 4.0.0
240+ session .install ("protobuf<4.0.0" )
241+
242+ default (
243+ session = session ,
244+ install_grpc = install_grpc ,
245+ install_async_rest = install_async_rest ,
239246 )
240- # Install grpcio-gcp
241- session .install ("-e" , ".[grpcgcp]" , "-c" , constraints_path )
242- # Install protobuf < 4.0.0
243- session .install ("protobuf<4.0.0" )
244-
245- default (session )
246-
247-
248- @nox .session (python = PYTHON_VERSIONS )
249- def unit_wo_grpc (session ):
250- """Run the unit test suite w/o grpcio installed"""
251- default (session , install_grpc = False )
252247
253248
254249@nox .session (python = PYTHON_VERSIONS )
255- def unit_w_async_rest_extra (session ):
256- """Run the unit test suite with the `async_rest` extra """
257- default (session , install_async_rest = True )
250+ def prerelease_deps (session ):
251+ """Run the unit test suite. """
252+ default (session , prerelease = True )
258253
259254
260255@nox .session (python = DEFAULT_PYTHON_VERSION )
0 commit comments