Skip to content

Commit f02739f

Browse files
tests: update default runtime used for tests (#1498)
* tests: update default runtime used for tests * update system presubmits * update conformance presubmit * install setuptools for lint_setup_py * lint * use venv instead of virtualenv for nox backend * Revert "use venv instead of virtualenv for nox backend" This reverts commit 7fc0fe8. * remove unit 3.7/3.8 in default nox session * update comment * ignore lint false positive * Use python 3.10 for blacken nox session, which is the latest version available in the python post processor * 🦉 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 61c5d5f commit f02739f

File tree

10 files changed

+28
-17
lines changed

10 files changed

+28
-17
lines changed

.github/sync-repo-settings.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ branchProtectionRules:
99
requiredStatusCheckContexts:
1010
- 'Kokoro'
1111
- 'cla/google'
12-
- 'Kokoro system-3.8'
12+
- 'Kokoro system-3.12'
1313
- 'OwlBot Post Processor'
1414
- pattern: python2
1515
requiresCodeOwnerReviews: true

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,3 @@ system_tests/local_test_setup
6262
# Make sure a generated file isn't accidentally committed.
6363
pylintrc
6464
pylintrc.test
65-
66-
# Docker files
67-
get-docker.sh

.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,7 +3,7 @@
33
# Only run this nox session.
44
env_vars: {
55
key: "NOX_SESSION"
6-
value: "system-3.8"
6+
value: "system-3.12"
77
}
88

99
# Credentials needed to test universe domain.

google/cloud/storage/notification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def create(self, client=None, timeout=_DEFAULT_TIMEOUT, retry=None):
257257
with create_trace_span(name="Storage.BucketNotification.create"):
258258
if self.notification_id is not None:
259259
raise ValueError(
260-
f"notification_id already set to {self.notification_id}; must be None to create a Notification."
260+
f"notification_id already set to {self.notification_id}; must be None to create a Notification." # noqa: E702
261261
)
262262

263263
client = self._require_client(client)

noxfile.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
BLACK_VERSION = "black==23.7.0"
2727
BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]
2828

29-
DEFAULT_PYTHON_VERSION = "3.8"
30-
SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"]
29+
DEFAULT_PYTHON_VERSION = "3.12"
30+
SYSTEM_TEST_PYTHON_VERSIONS = ["3.12"]
3131
UNIT_TEST_PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
32-
CONFORMANCE_TEST_PYTHON_VERSIONS = ["3.8"]
32+
CONFORMANCE_TEST_PYTHON_VERSIONS = ["3.12"]
3333

3434
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
3535

@@ -44,7 +44,13 @@
4444
"lint",
4545
"lint_setup_py",
4646
"system",
47-
"unit",
47+
# TODO(https://github.com/googleapis/python-storage/issues/1499):
48+
# Remove or restore testing for Python 3.7/3.8
49+
"unit-3.9",
50+
"unit-3.10",
51+
"unit-3.11",
52+
"unit-3.12",
53+
"unit-3.13",
4854
# cover must be last to avoid error `No data to report`
4955
"cover",
5056
]
@@ -68,7 +74,9 @@ def lint(session):
6874
session.run("flake8", "google", "tests")
6975

7076

71-
@nox.session(python=DEFAULT_PYTHON_VERSION)
77+
# Use a python runtime which is available in the owlbot post processor here
78+
# https://github.com/googleapis/synthtool/blob/master/docker/owlbot/python/Dockerfile
79+
@nox.session(python=["3.10", DEFAULT_PYTHON_VERSION])
7280
def blacken(session):
7381
"""Run black.
7482
@@ -84,7 +92,7 @@ def blacken(session):
8492
@nox.session(python=DEFAULT_PYTHON_VERSION)
8593
def lint_setup_py(session):
8694
"""Verify that setup.py is valid (including RST check)."""
87-
session.install("docutils", "pygments")
95+
session.install("docutils", "pygments", "setuptools>=79.0.1")
8896
session.run("python", "setup.py", "check", "--restructuredtext", "--strict")
8997

9098

owlbot.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,6 @@
104104

105105
python.py_samples(skip_readmes=True)
106106

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

tests/resumable_media/system/requests/test_download.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,9 @@ def test_download_to_stream(self, add_files, authorized_transport):
324324
check_tombstoned(download, authorized_transport)
325325

326326
@pytest.mark.parametrize("checksum", ["auto", "md5", "crc32c", None])
327-
def test_single_shot_download_to_stream(self, add_files, authorized_transport, checksum):
327+
def test_single_shot_download_to_stream(
328+
self, add_files, authorized_transport, checksum
329+
):
328330
for info in ALL_FILES:
329331
actual_contents = self._get_contents(info)
330332
blob_name = get_blob_name(info)

tests/resumable_media/unit/requests/test_download.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1370,7 +1370,9 @@ def _mock_response(status_code=http.client.OK, chunks=None, headers=None):
13701370
response.__enter__.return_value = response
13711371
response.__exit__.return_value = None
13721372
response.iter_content.return_value = iter(chunks)
1373-
response.raw.read = mock.Mock(side_effect=lambda *args, **kwargs: b"".join(chunks))
1373+
response.raw.read = mock.Mock(
1374+
side_effect=lambda *args, **kwargs: b"".join(chunks)
1375+
)
13741376
return response
13751377
else:
13761378
return mock.Mock(

tests/unit/test_blob.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2099,7 +2099,7 @@ def _download_as_text_helper(
20992099

21002100
properties = {}
21012101
if charset is not None:
2102-
properties["contentType"] = f"text/plain; charset={charset}"
2102+
properties["contentType"] = f"text/plain; charset={charset}" # noqa: E702
21032103
elif no_charset:
21042104
properties = {"contentType": "text/plain"}
21052105

tests/unit/test_bucket.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4094,7 +4094,7 @@ def _generate_upload_policy_helper(self, **kwargs):
40944094
break
40954095
else: # pragma: NO COVER
40964096
self.fail(
4097-
f"Condition {expected_condition} not found in {policy_conditions}"
4097+
f"Condition {expected_condition} not found in {policy_conditions}" # noqa: E713
40984098
)
40994099

41004100
return policy_fields, policy

0 commit comments

Comments
 (0)