Skip to content

Commit 4508a39

Browse files
committed
update yaml to patch noxfile
1 parent 4ba178c commit 4508a39

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.librarian/generator-input/client-post-processing/datastore-integration.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,60 @@ replacements:
183183
"ExplainOptions",
184184
"Transaction",
185185
]
186+
count: 1
187+
- paths: [
188+
"packages/google-cloud-datastore/noxfile.py",
189+
]
190+
before: |
191+
@nox\.session\(python=SYSTEM_TEST_PYTHON_VERSIONS\)
192+
def system\(session\):\s+"""Run the system test suite\."""[\s\S]*?system_test_folder_path,\s*\*session\.posargs,\s*\)
193+
after: |
194+
@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
195+
@nox.parametrize("disable_grpc", [False, True])
196+
def system(session, disable_grpc):
197+
"""Run the system test suite."""
198+
constraints_path = str(
199+
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
200+
)
201+
system_test_path = os.path.join("tests", "system.py")
202+
system_test_folder_path = os.path.join("tests", "system")
203+
204+
# Check the value of `RUN_SYSTEM_TESTS` env var. It defaults to true.
205+
if os.environ.get("RUN_SYSTEM_TESTS", "true") == "false":
206+
session.skip("RUN_SYSTEM_TESTS is set to false, skipping")
207+
# Install pyopenssl for mTLS testing.
208+
if os.environ.get("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true":
209+
session.install("pyopenssl")
210+
211+
system_test_exists = os.path.exists(system_test_path)
212+
system_test_folder_exists = os.path.exists(system_test_folder_path)
213+
# Sanity check: only run tests if found.
214+
if not system_test_exists and not system_test_folder_exists:
215+
session.skip("System tests were not found")
216+
217+
install_systemtest_dependencies(session, "-c", constraints_path)
218+
219+
env = {}
220+
if disable_grpc:
221+
env["GOOGLE_CLOUD_DISABLE_GRPC"] = "True"
222+
223+
# Run py.test against the system tests.
224+
if system_test_exists:
225+
session.run(
226+
"py.test",
227+
"--quiet",
228+
f"--junitxml=system_{session.python}_sponge_log.xml",
229+
system_test_path,
230+
env=env,
231+
*session.posargs,
232+
)
233+
if system_test_folder_exists:
234+
session.run(
235+
"py.test",
236+
"--quiet",
237+
f"--junitxml=system_{session.python}_sponge_log.xml",
238+
system_test_folder_path,
239+
env=env,
240+
*session.posargs,
241+
)
186242
count: 1

0 commit comments

Comments
 (0)