diff --git a/.kokoro/presubmit/presubmit.cfg b/.kokoro/presubmit/presubmit.cfg index b158096f0..17d071cae 100644 --- a/.kokoro/presubmit/presubmit.cfg +++ b/.kokoro/presubmit/presubmit.cfg @@ -5,3 +5,7 @@ env_vars: { key: "RUN_SYSTEM_TESTS" value: "false" } +env_vars: { + key: "RUN_SNIPPETS_TESTS" + value: "false" +} diff --git a/.kokoro/presubmit/snippets-2.7.cfg b/.kokoro/presubmit/snippets-2.7.cfg new file mode 100644 index 000000000..3bd6134d2 --- /dev/null +++ b/.kokoro/presubmit/snippets-2.7.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Only run this nox session. +env_vars: { + key: "NOX_SESSION" + value: "snippets-2.7" +} diff --git a/.kokoro/presubmit/snippets-3.8.cfg b/.kokoro/presubmit/snippets-3.8.cfg new file mode 100644 index 000000000..840d9e716 --- /dev/null +++ b/.kokoro/presubmit/snippets-3.8.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Only run this nox session. +env_vars: { + key: "NOX_SESSION" + value: "snippets-3.8" +} diff --git a/noxfile.py b/noxfile.py index db1dcffde..441782583 100644 --- a/noxfile.py +++ b/noxfile.py @@ -112,14 +112,18 @@ def system(session): def snippets(session): """Run the snippets test suite.""" - constraints_path = str( - CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" - ) + # Check the value of `RUN_SNIPPETS_TESTS` env var. It defaults to true. + if os.environ.get("RUN_SNIPPETS_TESTS", "true") == "false": + session.skip("RUN_SNIPPETS_TESTS is set to false, skipping") # Sanity check: Only run snippets tests if the environment variable is set. if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""): session.skip("Credentials must be set via environment variable.") + constraints_path = str( + CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" + ) + # Install all test dependencies, then install local packages in place. session.install("mock", "pytest", "google-cloud-testutils", "-c", constraints_path) session.install("google-cloud-storage", "-c", constraints_path)