Skip to content

Commit

Permalink
build: add mock server tests to Owlbot config
Browse files Browse the repository at this point in the history
  • Loading branch information
olavloite committed Dec 5, 2024
1 parent 7df93ca commit 33aa2ba
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,4 +307,50 @@ def prerelease_deps\(session, protobuf_implementation\):""",
def prerelease_deps(session, protobuf_implementation, database_dialect):""",
)


mockserver_test = """
@nox.session(python=DEFAULT_MOCK_SERVER_TESTS_PYTHON_VERSION)
def mockserver(session):
# Install all test dependencies, then install this package in-place.
constraints_path = str(
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
)
# install_unittest_dependencies(session, "-c", constraints_path)
standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES
session.install(*standard_deps, "-c", constraints_path)
session.install("-e", ".", "-c", constraints_path)
# Run py.test against the mockserver tests.
session.run(
"py.test",
"--quiet",
f"--junitxml=unit_{session.python}_sponge_log.xml",
"--cov=google",
"--cov=tests/unit",
"--cov-append",
"--cov-config=.coveragerc",
"--cov-report=",
"--cov-fail-under=0",
os.path.join("tests", "mockserver_tests"),
*session.posargs,
)
"""

place_before(
"noxfile.py",
"def install_systemtest_dependencies(session, *constraints):",
mockserver_test,
escape="()",
)

place_before(
"noxfile.py",
"UNIT_TEST_PYTHON_VERSIONS: List[str] = [",
'DEFAULT_MOCK_SERVER_TESTS_PYTHON_VERSION = "3.12"',
escape="()",
)

s.shell.run(["nox", "-s", "blacken"], hide_output=False)

0 comments on commit 33aa2ba

Please sign in to comment.