85
85
"format" ,
86
86
]
87
87
88
+
88
89
# Error if a python version is missing
89
90
nox .options .error_on_missing_interpreters = True
90
91
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:" )
91
95
92
96
@nox .session (python = DEFAULT_PYTHON_VERSION )
93
97
def lint (session ):
98
+ install_default_packages (session )
94
99
"""Run linters.
95
100
96
101
Returns a failure if the linters find linting errors or sufficiently
@@ -107,6 +112,7 @@ def lint(session):
107
112
108
113
@nox .session (python = DEFAULT_PYTHON_VERSION )
109
114
def blacken (session ):
115
+ install_default_packages (session )
110
116
"""Run black. Format code to uniform standard."""
111
117
session .install (BLACK_VERSION )
112
118
session .run (
@@ -117,6 +123,7 @@ def blacken(session):
117
123
118
124
@nox .session (python = DEFAULT_PYTHON_VERSION )
119
125
def format (session ):
126
+ install_default_packages (session )
120
127
"""
121
128
Run isort to sort imports. Then run black
122
129
to format code to uniform standard.
@@ -137,12 +144,15 @@ def format(session):
137
144
138
145
@nox .session (python = DEFAULT_PYTHON_VERSION )
139
146
def lint_setup_py (session ):
147
+ install_default_packages (session )
140
148
"""Verify that setup.py is valid (including RST check)."""
141
149
session .install ("docutils" , "pygments" )
142
150
session .run ("python" , "setup.py" , "check" , "--restructuredtext" , "--strict" )
143
151
144
152
145
153
def install_unittest_dependencies (session , * constraints ):
154
+ install_default_packages (session )
155
+
146
156
standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES
147
157
session .install (* standard_deps , * constraints )
148
158
@@ -238,6 +248,7 @@ def unit(session, protobuf_implementation):
238
248
@nox .session (python = DEFAULT_MOCK_SERVER_TESTS_PYTHON_VERSION )
239
249
def mockserver (session ):
240
250
# Install all test dependencies, then install this package in-place.
251
+ install_default_packages (session )
241
252
242
253
constraints_path = str (
243
254
CURRENT_DIRECTORY / "testing" / f"constraints-{ session .python } .txt"
@@ -267,6 +278,7 @@ def install_systemtest_dependencies(session, *constraints):
267
278
# Use pre-release gRPC for system tests.
268
279
# Exclude version 1.52.0rc1 which has a known issue.
269
280
# See https://github.com/grpc/grpc/issues/32163
281
+ install_default_packages (session )
270
282
session .install ("--pre" , "grpcio!=1.52.0rc1" )
271
283
272
284
session .install (* SYSTEM_TEST_STANDARD_DEPENDENCIES , * constraints )
@@ -292,7 +304,6 @@ def install_systemtest_dependencies(session, *constraints):
292
304
else :
293
305
session .install ("-e" , "." , * constraints )
294
306
295
-
296
307
@nox .session (python = SYSTEM_TEST_PYTHON_VERSIONS )
297
308
@nox .parametrize ("database_dialect" , ["GOOGLE_STANDARD_SQL" , "POSTGRESQL" ])
298
309
def system (session , database_dialect ):
@@ -363,6 +374,7 @@ def cover(session):
363
374
This outputs the coverage report aggregating coverage from the unit
364
375
test runs (not system test runs), and then erases coverage data.
365
376
"""
377
+ install_default_packages (session )
366
378
session .install ("coverage" , "pytest-cov" )
367
379
session .run ("coverage" , "report" , "--show-missing" , "--fail-under=98" )
368
380
@@ -372,7 +384,7 @@ def cover(session):
372
384
@nox .session (python = "3.10" )
373
385
def docs (session ):
374
386
"""Build the docs for this library."""
375
-
387
+ install_default_packages ( session )
376
388
session .install ("-e" , ".[tracing]" )
377
389
session .install (
378
390
# We need to pin to specific versions of the `sphinxcontrib-*` packages
@@ -407,7 +419,7 @@ def docs(session):
407
419
@nox .session (python = "3.10" )
408
420
def docfx (session ):
409
421
"""Build the docfx yaml files for this library."""
410
-
422
+ install_default_packages ( session )
411
423
session .install ("-e" , ".[tracing]" )
412
424
session .install (
413
425
# We need to pin to specific versions of the `sphinxcontrib-*` packages
@@ -469,6 +481,7 @@ def prerelease_deps(session, protobuf_implementation, database_dialect):
469
481
session .skip ("cpp implementation is not supported in python 3.11+" )
470
482
471
483
# Install all dependencies
484
+ install_default_packages (session )
472
485
session .install ("-e" , ".[all, tests, tracing]" )
473
486
unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
474
487
session .install (* unit_deps_all )
0 commit comments