From 33aa2bacf95ca66626233d61bb856b5805fe5f3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Thu, 5 Dec 2024 11:50:24 +0100 Subject: [PATCH 1/3] build: add mock server tests to Owlbot config --- owlbot.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/owlbot.py b/owlbot.py index c215f26946..2e09d36e77 100644 --- a/owlbot.py +++ b/owlbot.py @@ -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) From b8b5baf48c04011e576de1796a2c9948850c63ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Thu, 5 Dec 2024 15:15:47 +0100 Subject: [PATCH 2/3] chore: add escapes --- owlbot.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/owlbot.py b/owlbot.py index 2e09d36e77..e7fb391c2a 100644 --- a/owlbot.py +++ b/owlbot.py @@ -336,21 +336,20 @@ def mockserver(session): *session.posargs, ) - """ place_before( "noxfile.py", "def install_systemtest_dependencies(session, *constraints):", mockserver_test, - escape="()", + escape="()_*:", ) place_before( "noxfile.py", "UNIT_TEST_PYTHON_VERSIONS: List[str] = [", 'DEFAULT_MOCK_SERVER_TESTS_PYTHON_VERSION = "3.12"', - escape="()", + escape="[]", ) s.shell.run(["nox", "-s", "blacken"], hide_output=False) From f21fa586ffbcb0fccc7ccab38d1192bc1953ed2e Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 5 Dec 2024 14:18:12 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 905df735bc..f32c24f1e3 100644 --- a/noxfile.py +++ b/noxfile.py @@ -33,8 +33,8 @@ LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" -DEFAULT_MOCK_SERVER_TESTS_PYTHON_VERSION = "3.12" +DEFAULT_MOCK_SERVER_TESTS_PYTHON_VERSION = "3.12" UNIT_TEST_PYTHON_VERSIONS: List[str] = [ "3.7", "3.8",