diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index cc1eb10e1..0d304cfe2 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -9,7 +9,7 @@ branchProtectionRules: requiredStatusCheckContexts: - 'Kokoro' - 'cla/google' - - 'Kokoro system-3.8' + - 'Kokoro system-3.12' - 'OwlBot Post Processor' - pattern: python2 requiresCodeOwnerReviews: true diff --git a/.gitignore b/.gitignore index 6f2ab1aff..d083ea1dd 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/.kokoro/presubmit/system-3.8.cfg b/.kokoro/presubmit/system-3.12.cfg similarity index 91% rename from .kokoro/presubmit/system-3.8.cfg rename to .kokoro/presubmit/system-3.12.cfg index 6d3603eed..d4cca031b 100644 --- a/.kokoro/presubmit/system-3.8.cfg +++ b/.kokoro/presubmit/system-3.12.cfg @@ -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. diff --git a/google/cloud/storage/notification.py b/google/cloud/storage/notification.py index d13b80fc4..2dddbcee4 100644 --- a/google/cloud/storage/notification.py +++ b/google/cloud/storage/notification.py @@ -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) diff --git a/noxfile.py b/noxfile.py index 2a7614331..b62092e97 100644 --- a/noxfile.py +++ b/noxfile.py @@ -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() @@ -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", ] @@ -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. @@ -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") diff --git a/owlbot.py b/owlbot.py index ba3f32df3..5292db5fd 100644 --- a/owlbot.py +++ b/owlbot.py @@ -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) diff --git a/tests/resumable_media/system/requests/test_download.py b/tests/resumable_media/system/requests/test_download.py index 84c44c94c..5417dd7bc 100644 --- a/tests/resumable_media/system/requests/test_download.py +++ b/tests/resumable_media/system/requests/test_download.py @@ -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) diff --git a/tests/resumable_media/unit/requests/test_download.py b/tests/resumable_media/unit/requests/test_download.py index b17fbb905..25dba6e05 100644 --- a/tests/resumable_media/unit/requests/test_download.py +++ b/tests/resumable_media/unit/requests/test_download.py @@ -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( diff --git a/tests/unit/test_blob.py b/tests/unit/test_blob.py index 937bebaf5..b3e7ec649 100644 --- a/tests/unit/test_blob.py +++ b/tests/unit/test_blob.py @@ -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"} diff --git a/tests/unit/test_bucket.py b/tests/unit/test_bucket.py index ac9a5ede6..e494cc18a 100644 --- a/tests/unit/test_bucket.py +++ b/tests/unit/test_bucket.py @@ -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