Skip to content

tests: update default runtime used for tests #1498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jul 3, 2025
Merged
2 changes: 1 addition & 1 deletion .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ branchProtectionRules:
requiredStatusCheckContexts:
- 'Kokoro'
- 'cla/google'
- 'Kokoro system-3.8'
- 'Kokoro system-3.12'
- 'OwlBot Post Processor'
- pattern: python2
requiresCodeOwnerReviews: true
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,3 @@ system_tests/local_test_setup
# Make sure a generated file isn't accidentally committed.
pylintrc
pylintrc.test

# Docker files
get-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Only run this nox session.
env_vars: {
key: "NOX_SESSION"
value: "system-3.8"
value: "system-3.12"
}

# Credentials needed to test universe domain.
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/storage/notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def create(self, client=None, timeout=_DEFAULT_TIMEOUT, retry=None):
with create_trace_span(name="Storage.BucketNotification.create"):
if self.notification_id is not None:
raise ValueError(
f"notification_id already set to {self.notification_id}; must be None to create a Notification."
f"notification_id already set to {self.notification_id}; must be None to create a Notification." # noqa: E702
)

client = self._require_client(client)
Expand Down
20 changes: 14 additions & 6 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
BLACK_VERSION = "black==23.7.0"
BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]

DEFAULT_PYTHON_VERSION = "3.8"
SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"]
DEFAULT_PYTHON_VERSION = "3.12"
SYSTEM_TEST_PYTHON_VERSIONS = ["3.12"]
UNIT_TEST_PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
CONFORMANCE_TEST_PYTHON_VERSIONS = ["3.8"]
CONFORMANCE_TEST_PYTHON_VERSIONS = ["3.12"]

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

Expand All @@ -44,7 +44,13 @@
"lint",
"lint_setup_py",
"system",
"unit",
# TODO(https://github.com/googleapis/python-storage/issues/1499):
# Remove or restore testing for Python 3.7/3.8
"unit-3.9",
"unit-3.10",
"unit-3.11",
"unit-3.12",
"unit-3.13",
# cover must be last to avoid error `No data to report`
"cover",
]
Expand All @@ -68,7 +74,9 @@ def lint(session):
session.run("flake8", "google", "tests")


@nox.session(python=DEFAULT_PYTHON_VERSION)
# Use a python runtime which is available in the owlbot post processor here
# https://github.com/googleapis/synthtool/blob/master/docker/owlbot/python/Dockerfile
@nox.session(python=["3.10", DEFAULT_PYTHON_VERSION])
def blacken(session):
"""Run black.

Expand All @@ -84,7 +92,7 @@ def blacken(session):
@nox.session(python=DEFAULT_PYTHON_VERSION)
def lint_setup_py(session):
"""Verify that setup.py is valid (including RST check)."""
session.install("docutils", "pygments")
session.install("docutils", "pygments", "setuptools>=79.0.1")
session.run("python", "setup.py", "check", "--restructuredtext", "--strict")


Expand Down
4 changes: 3 additions & 1 deletion owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,6 @@

python.py_samples(skip_readmes=True)

s.shell.run(["nox", "-s", "blacken"], hide_output=False)
# Use a python runtime which is available in the owlbot post processor here
# https://github.com/googleapis/synthtool/blob/master/docker/owlbot/python/Dockerfile
s.shell.run(["nox", "-s", "blacken-3.10"], hide_output=False)
4 changes: 3 additions & 1 deletion tests/resumable_media/system/requests/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,9 @@ def test_download_to_stream(self, add_files, authorized_transport):
check_tombstoned(download, authorized_transport)

@pytest.mark.parametrize("checksum", ["auto", "md5", "crc32c", None])
def test_single_shot_download_to_stream(self, add_files, authorized_transport, checksum):
def test_single_shot_download_to_stream(
self, add_files, authorized_transport, checksum
):
for info in ALL_FILES:
actual_contents = self._get_contents(info)
blob_name = get_blob_name(info)
Expand Down
4 changes: 3 additions & 1 deletion tests/resumable_media/unit/requests/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -1370,7 +1370,9 @@ def _mock_response(status_code=http.client.OK, chunks=None, headers=None):
response.__enter__.return_value = response
response.__exit__.return_value = None
response.iter_content.return_value = iter(chunks)
response.raw.read = mock.Mock(side_effect=lambda *args, **kwargs: b"".join(chunks))
response.raw.read = mock.Mock(
side_effect=lambda *args, **kwargs: b"".join(chunks)
)
return response
else:
return mock.Mock(
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -2099,7 +2099,7 @@ def _download_as_text_helper(

properties = {}
if charset is not None:
properties["contentType"] = f"text/plain; charset={charset}"
properties["contentType"] = f"text/plain; charset={charset}" # noqa: E702
elif no_charset:
properties = {"contentType": "text/plain"}

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -4094,7 +4094,7 @@ def _generate_upload_policy_helper(self, **kwargs):
break
else: # pragma: NO COVER
self.fail(
f"Condition {expected_condition} not found in {policy_conditions}"
f"Condition {expected_condition} not found in {policy_conditions}" # noqa: E713
)

return policy_fields, policy
Expand Down