Skip to content

Commit

Permalink
tests: split out snippets builds (#219)
Browse files Browse the repository at this point in the history
@tmatsuo Emulating PR #207. I don't know if I'm missing anything:  e.g., I don't quite understand what the `split_system_tests=True` does in the `synth.py` there.

Toward #191
  • Loading branch information
tseaver committed Oct 16, 2020
1 parent cebb5e0 commit 29dd573
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .kokoro/presubmit/presubmit.cfg
Expand Up @@ -5,3 +5,7 @@ env_vars: {
key: "RUN_SYSTEM_TESTS"
value: "false"
}
env_vars: {
key: "RUN_SNIPPETS_TESTS"
value: "false"
}
7 changes: 7 additions & 0 deletions .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"
}
7 changes: 7 additions & 0 deletions .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"
}
10 changes: 7 additions & 3 deletions noxfile.py
Expand Up @@ -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)
Expand Down

0 comments on commit 29dd573

Please sign in to comment.