Skip to content

Commit f81fbd5

Browse files
tests: update default runtime used for tests (#1391)
* tests: update default runtime used for tests * set default python runtime used for tests to 3.12 * Use python 3.10 for blacken nox session, which is the latest version available in the python post processor * update sync-repo-settings.yaml * install setuptools for lint_setup_py * remove unit 3.7/3.8 in default nox session * update python runtime in system tests to 3.12 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * remove obsolete config * set python 3.12 as runtime for system test * exclude cpp for python 3.11+ --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent ce3f230 commit f81fbd5

File tree

6 files changed

+25
-10
lines changed

6 files changed

+25
-10
lines changed

.github/sync-repo-settings.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ branchProtectionRules:
88
requiresStrictStatusChecks: true
99
requiredStatusCheckContexts:
1010
- 'Kokoro'
11-
- 'Kokoro system-3.8'
11+
- 'Kokoro system-3.12'
1212
- 'cla/google'
1313
- 'Samples - Lint'
1414
- 'Samples - Python 3.8'

.kokoro/presubmit/integration-multiplexed-sessions-enabled.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Only run a subset of all nox sessions
44
env_vars: {
55
key: "NOX_SESSION"
6-
value: "unit-3.8 unit-3.12 system-3.8"
6+
value: "unit-3.9 unit-3.12 system-3.12"
77
}
88

99
env_vars: {

.kokoro/presubmit/presubmit.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
# Only run a subset of all nox sessions
44
env_vars: {
55
key: "NOX_SESSION"
6-
value: "unit-3.8 unit-3.12 cover docs docfx"
6+
value: "unit-3.9 unit-3.12 cover docs docfx"
77
}

.kokoro/presubmit/system-3.8.cfg renamed to .kokoro/presubmit/system-3.12.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
# Only run this nox session.
44
env_vars: {
55
key: "NOX_SESSION"
6-
value: "system-3.8"
6+
value: "system-3.12"
77
}

noxfile.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@
3232
ISORT_VERSION = "isort==5.11.0"
3333
LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]
3434

35-
DEFAULT_PYTHON_VERSION = "3.8"
35+
DEFAULT_PYTHON_VERSION = "3.12"
3636

3737
DEFAULT_MOCK_SERVER_TESTS_PYTHON_VERSION = "3.12"
38+
SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.12"]
39+
3840
UNIT_TEST_PYTHON_VERSIONS: List[str] = [
3941
"3.7",
4042
"3.8",
@@ -60,7 +62,6 @@
6062
UNIT_TEST_EXTRAS: List[str] = []
6163
UNIT_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {}
6264

63-
SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.8"]
6465
SYSTEM_TEST_STANDARD_DEPENDENCIES: List[str] = [
6566
"mock",
6667
"pytest",
@@ -77,7 +78,13 @@
7778
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
7879

7980
nox.options.sessions = [
80-
"unit",
81+
# TODO(https://github.com/googleapis/python-spanner/issues/1392):
82+
# Remove or restore testing for Python 3.7/3.8
83+
"unit-3.9",
84+
"unit-3.10",
85+
"unit-3.11",
86+
"unit-3.12",
87+
"unit-3.13",
8188
"system",
8289
"cover",
8390
"lint",
@@ -108,7 +115,9 @@ def lint(session):
108115
session.run("flake8", "google", "tests")
109116

110117

111-
@nox.session(python=DEFAULT_PYTHON_VERSION)
118+
# Use a python runtime which is available in the owlbot post processor here
119+
# https://github.com/googleapis/synthtool/blob/master/docker/owlbot/python/Dockerfile
120+
@nox.session(python=["3.10", DEFAULT_PYTHON_VERSION])
112121
def blacken(session):
113122
"""Run black. Format code to uniform standard."""
114123
session.install(BLACK_VERSION)
@@ -141,7 +150,7 @@ def format(session):
141150
@nox.session(python=DEFAULT_PYTHON_VERSION)
142151
def lint_setup_py(session):
143152
"""Verify that setup.py is valid (including RST check)."""
144-
session.install("docutils", "pygments")
153+
session.install("docutils", "pygments", "setuptools>=79.0.1")
145154
session.run("python", "setup.py", "check", "--restructuredtext", "--strict")
146155

147156

@@ -321,6 +330,9 @@ def system(session, protobuf_implementation, database_dialect):
321330
"Only run system tests on real Spanner with one protobuf implementation to speed up the build"
322331
)
323332

333+
if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"):
334+
session.skip("cpp implementation is not supported in python 3.11+")
335+
324336
# Install pyopenssl for mTLS testing.
325337
if os.environ.get("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true":
326338
session.install("pyopenssl")

owlbot.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ def get_staging_dirs(
225225
cov_level=98,
226226
split_system_tests=True,
227227
system_test_extras=["tracing"],
228+
system_test_python_versions=["3.12"]
228229
)
229230
s.move(
230231
templated_files,
@@ -258,4 +259,6 @@ def get_staging_dirs(
258259

259260
python.py_samples()
260261

261-
s.shell.run(["nox", "-s", "blacken"], hide_output=False)
262+
# Use a python runtime which is available in the owlbot post processor here
263+
# https://github.com/googleapis/synthtool/blob/master/docker/owlbot/python/Dockerfile
264+
s.shell.run(["nox", "-s", "blacken-3.10"], hide_output=False)

0 commit comments

Comments
 (0)