Skip to content

Commit a81af3b

Browse files
build: add mock server tests to Owlbot config (#1254)
* build: add mock server tests to Owlbot config * chore: add escapes * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent c064815 commit a81af3b

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]
3434

3535
DEFAULT_PYTHON_VERSION = "3.8"
36-
DEFAULT_MOCK_SERVER_TESTS_PYTHON_VERSION = "3.12"
3736

37+
DEFAULT_MOCK_SERVER_TESTS_PYTHON_VERSION = "3.12"
3838
UNIT_TEST_PYTHON_VERSIONS: List[str] = [
3939
"3.7",
4040
"3.8",

owlbot.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,4 +307,49 @@ 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+
place_before(
342+
"noxfile.py",
343+
"def install_systemtest_dependencies(session, *constraints):",
344+
mockserver_test,
345+
escape="()_*:",
346+
)
347+
348+
place_before(
349+
"noxfile.py",
350+
"UNIT_TEST_PYTHON_VERSIONS: List[str] = [",
351+
'DEFAULT_MOCK_SERVER_TESTS_PYTHON_VERSION = "3.12"',
352+
escape="[]",
353+
)
354+
310355
s.shell.run(["nox", "-s", "blacken"], hide_output=False)

0 commit comments

Comments
 (0)