Skip to content

Commit 33aa2ba

Browse files
committed
build: add mock server tests to Owlbot config
1 parent 7df93ca commit 33aa2ba

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

owlbot.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,4 +307,50 @@ def prerelease_deps\(session, protobuf_implementation\):""",
307307
def prerelease_deps(session, protobuf_implementation, database_dialect):""",
308308
)
309309

310+
311+
mockserver_test = """
312+
@nox.session(python=DEFAULT_MOCK_SERVER_TESTS_PYTHON_VERSION)
313+
def mockserver(session):
314+
# Install all test dependencies, then install this package in-place.
315+
316+
constraints_path = str(
317+
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
318+
)
319+
# install_unittest_dependencies(session, "-c", constraints_path)
320+
standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES
321+
session.install(*standard_deps, "-c", constraints_path)
322+
session.install("-e", ".", "-c", constraints_path)
323+
324+
# Run py.test against the mockserver tests.
325+
session.run(
326+
"py.test",
327+
"--quiet",
328+
f"--junitxml=unit_{session.python}_sponge_log.xml",
329+
"--cov=google",
330+
"--cov=tests/unit",
331+
"--cov-append",
332+
"--cov-config=.coveragerc",
333+
"--cov-report=",
334+
"--cov-fail-under=0",
335+
os.path.join("tests", "mockserver_tests"),
336+
*session.posargs,
337+
)
338+
339+
340+
"""
341+
342+
place_before(
343+
"noxfile.py",
344+
"def install_systemtest_dependencies(session, *constraints):",
345+
mockserver_test,
346+
escape="()",
347+
)
348+
349+
place_before(
350+
"noxfile.py",
351+
"UNIT_TEST_PYTHON_VERSIONS: List[str] = [",
352+
'DEFAULT_MOCK_SERVER_TESTS_PYTHON_VERSION = "3.12"',
353+
escape="()",
354+
)
355+
310356
s.shell.run(["nox", "-s", "blacken"], hide_output=False)

0 commit comments

Comments
 (0)