8585 "format" ,
8686]
8787
88+
8889# Error if a python version is missing
8990nox .options .error_on_missing_interpreters = True
9091
92+ def install_default_packages (session ):
93+ if os .environ .get ("USE_AIRLOCK" ) == "true" :
94+ session .install ("-r" , ".kokoro/requirements-auth.txt" , "-i" , "https://pypi.org/simple/" , "--require-hashes" , "--only-binary" , ":all:" )
9195
9296@nox .session (python = DEFAULT_PYTHON_VERSION )
9397def lint (session ):
98+ install_default_packages (session )
9499 """Run linters.
95100
96101 Returns a failure if the linters find linting errors or sufficiently
@@ -107,6 +112,7 @@ def lint(session):
107112
108113@nox .session (python = DEFAULT_PYTHON_VERSION )
109114def blacken (session ):
115+ install_default_packages (session )
110116 """Run black. Format code to uniform standard."""
111117 session .install (BLACK_VERSION )
112118 session .run (
@@ -117,6 +123,7 @@ def blacken(session):
117123
118124@nox .session (python = DEFAULT_PYTHON_VERSION )
119125def format (session ):
126+ install_default_packages (session )
120127 """
121128 Run isort to sort imports. Then run black
122129 to format code to uniform standard.
@@ -137,12 +144,15 @@ def format(session):
137144
138145@nox .session (python = DEFAULT_PYTHON_VERSION )
139146def lint_setup_py (session ):
147+ install_default_packages (session )
140148 """Verify that setup.py is valid (including RST check)."""
141149 session .install ("docutils" , "pygments" )
142150 session .run ("python" , "setup.py" , "check" , "--restructuredtext" , "--strict" )
143151
144152
145153def install_unittest_dependencies (session , * constraints ):
154+ install_default_packages (session )
155+
146156 standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES
147157 session .install (* standard_deps , * constraints )
148158
@@ -238,6 +248,7 @@ def unit(session, protobuf_implementation):
238248@nox .session (python = DEFAULT_MOCK_SERVER_TESTS_PYTHON_VERSION )
239249def mockserver (session ):
240250 # Install all test dependencies, then install this package in-place.
251+ install_default_packages (session )
241252
242253 constraints_path = str (
243254 CURRENT_DIRECTORY / "testing" / f"constraints-{ session .python } .txt"
@@ -267,6 +278,7 @@ def install_systemtest_dependencies(session, *constraints):
267278 # Use pre-release gRPC for system tests.
268279 # Exclude version 1.52.0rc1 which has a known issue.
269280 # See https://github.com/grpc/grpc/issues/32163
281+ install_default_packages (session )
270282 session .install ("--pre" , "grpcio!=1.52.0rc1" )
271283
272284 session .install (* SYSTEM_TEST_STANDARD_DEPENDENCIES , * constraints )
@@ -292,7 +304,6 @@ def install_systemtest_dependencies(session, *constraints):
292304 else :
293305 session .install ("-e" , "." , * constraints )
294306
295-
296307@nox .session (python = SYSTEM_TEST_PYTHON_VERSIONS )
297308@nox .parametrize ("database_dialect" , ["GOOGLE_STANDARD_SQL" , "POSTGRESQL" ])
298309def system (session , database_dialect ):
@@ -363,6 +374,7 @@ def cover(session):
363374 This outputs the coverage report aggregating coverage from the unit
364375 test runs (not system test runs), and then erases coverage data.
365376 """
377+ install_default_packages (session )
366378 session .install ("coverage" , "pytest-cov" )
367379 session .run ("coverage" , "report" , "--show-missing" , "--fail-under=98" )
368380
@@ -372,7 +384,7 @@ def cover(session):
372384@nox .session (python = "3.10" )
373385def docs (session ):
374386 """Build the docs for this library."""
375-
387+ install_default_packages ( session )
376388 session .install ("-e" , ".[tracing]" )
377389 session .install (
378390 # We need to pin to specific versions of the `sphinxcontrib-*` packages
@@ -407,7 +419,7 @@ def docs(session):
407419@nox .session (python = "3.10" )
408420def docfx (session ):
409421 """Build the docfx yaml files for this library."""
410-
422+ install_default_packages ( session )
411423 session .install ("-e" , ".[tracing]" )
412424 session .install (
413425 # We need to pin to specific versions of the `sphinxcontrib-*` packages
@@ -469,6 +481,7 @@ def prerelease_deps(session, protobuf_implementation, database_dialect):
469481 session .skip ("cpp implementation is not supported in python 3.11+" )
470482
471483 # Install all dependencies
484+ install_default_packages (session )
472485 session .install ("-e" , ".[all, tests, tracing]" )
473486 unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
474487 session .install (* unit_deps_all )
0 commit comments