Skip to content

Commit 29dd573

Browse files
authored
tests: split out snippets builds (#219)
@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
1 parent cebb5e0 commit 29dd573

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

.kokoro/presubmit/presubmit.cfg

+4
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ env_vars: {
55
key: "RUN_SYSTEM_TESTS"
66
value: "false"
77
}
8+
env_vars: {
9+
key: "RUN_SNIPPETS_TESTS"
10+
value: "false"
11+
}

.kokoro/presubmit/snippets-2.7.cfg

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Only run this nox session.
4+
env_vars: {
5+
key: "NOX_SESSION"
6+
value: "snippets-2.7"
7+
}

.kokoro/presubmit/snippets-3.8.cfg

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Only run this nox session.
4+
env_vars: {
5+
key: "NOX_SESSION"
6+
value: "snippets-3.8"
7+
}

noxfile.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,18 @@ def system(session):
112112
def snippets(session):
113113
"""Run the snippets test suite."""
114114

115-
constraints_path = str(
116-
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
117-
)
115+
# Check the value of `RUN_SNIPPETS_TESTS` env var. It defaults to true.
116+
if os.environ.get("RUN_SNIPPETS_TESTS", "true") == "false":
117+
session.skip("RUN_SNIPPETS_TESTS is set to false, skipping")
118118

119119
# Sanity check: Only run snippets tests if the environment variable is set.
120120
if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""):
121121
session.skip("Credentials must be set via environment variable.")
122122

123+
constraints_path = str(
124+
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
125+
)
126+
123127
# Install all test dependencies, then install local packages in place.
124128
session.install("mock", "pytest", "google-cloud-testutils", "-c", constraints_path)
125129
session.install("google-cloud-storage", "-c", constraints_path)

0 commit comments

Comments
 (0)