@@ -185,7 +185,7 @@ def format(session):
185185@nox .session (python = DEFAULT_PYTHON_VERSION )
186186def lint_setup_py (session ):
187187 """Verify that setup.py is valid (including RST check)."""
188- session .install ("docutils" , "pygments" )
188+ session .install ("docutils" , "pygments" , "setuptools" )
189189 session .run ("python" , "setup.py" , "check" , "--restructuredtext" , "--strict" )
190190
191191
@@ -308,6 +308,10 @@ def system(session):
308308 # Check the value of `RUN_SYSTEM_TESTS` env var. It defaults to true.
309309 if os .environ .get ("RUN_SYSTEM_TESTS" , "true" ) == "false" :
310310 session .skip ("RUN_SYSTEM_TESTS is set to false, skipping" )
311+
312+ # Sanity check: Only run system tests if the environment variable is set.
313+ if not os .environ .get ("GOOGLE_APPLICATION_CREDENTIALS" , "" ):
314+ session .skip ("Credentials must be set via environment variable." )
311315 # Install pyopenssl for mTLS testing.
312316 if os .environ .get ("GOOGLE_API_USE_CLIENT_CERTIFICATE" , "false" ) == "true" :
313317 session .install ("pyopenssl" )
@@ -530,6 +534,10 @@ def prerelease_deps(session, protobuf_implementation):
530534 system_test_folder_path = os .path .join ("tests" , "system" )
531535
532536 # Only run system tests if found.
537+ if not os .environ .get ("GOOGLE_APPLICATION_CREDENTIALS" , "" ):
538+ session .log ("Skipping system tests because GOOGLE_APPLICATION_CREDENTIALS is not set." )
539+ return
540+
533541 if os .path .exists (system_test_path ):
534542 session .run (
535543 "py.test" ,
0 commit comments