FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: use version.py for versioning, avoid issues with discovering version via get_distribution by crwilcox · Pull Request #288 · googleapis/python-storage · GitHub

This repository was archived by the owner on Mar 31, 2026. It is now read-only.
/ python-storage Public archive

fix: use version.py for versioning, avoid issues with discovering version via get_distribution - #288

Merged
crwilcox merged 7 commits into
masterfrom
guard-get-distribution
Oct 6, 2020
Merged

fix: use version.py for versioning, avoid issues with discovering version via get_distribution#288
crwilcox merged 7 commits into
masterfrom
guard-get-distribution

Conversation

crwilcox commented Oct 6, 2020

Copy link
Copy Markdown
Contributor

No description provided.

google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Oct 6, 2020
crwilcox requested a review from andrewsg October 6, 2020 19:52
Comment thread google/cloud/storage/__init__.py Outdated
crwilcox force-pushed the guard-get-distribution branch from e9fb6f3 to 42ef9b7 Compare October 6, 2020 20:18
crwilcox force-pushed the guard-get-distribution branch from 42ef9b7 to 4e73155 Compare October 6, 2020 20:24

crwilcox commented Oct 6, 2020

Copy link
Copy Markdown
Contributor Author

As it is a bit more robust, I added version.py to google-cloud-storage

tseaver commented Oct 6, 2020

Copy link
Copy Markdown
Contributor

@crwilcox Needs a git add google/cloud/storage/version.py.

crwilcox commented Oct 6, 2020
edited
Loading

Copy link
Copy Markdown
Contributor Author

Test failures seem unrelated to me?

_______________________________________________________________ TestClient.test_lookup_bucket_with_metageneration_match ________________________________________________________________

self = <tests.unit.test_client.TestClient testMethod=test_lookup_bucket_with_metageneration_match>

    def test_lookup_bucket_with_metageneration_match(self):
        from google.cloud.storage.bucket import Bucket

        PROJECT = "PROJECT"
        CREDENTIALS = _make_credentials()
        METAGENERATION_NUMBER = 6
        client = self._make_one(project=PROJECT, credentials=CREDENTIALS)

        BUCKET_NAME = "bucket-name"
        URI1 = "/".join(
            [
                client._connection.API_BASE_URL,
                "storage",
                client._connection.API_VERSION,
                "b",
                "%s?projection=noAcl&ifMetagenerationMatch=%s"
                % (BUCKET_NAME, METAGENERATION_NUMBER),
            ]
        )
        URI2 = "/".join(
            [
                client._connection.API_BASE_URL,
                "storage",
                client._connection.API_VERSION,
                "b",
                "%s?ifMetagenerationMatch=%s&projection=noAcl"
                % (BUCKET_NAME, METAGENERATION_NUMBER),
            ]
        )
        data = {"name": BUCKET_NAME}
        http = _make_requests_session([_make_json_response(data)])
        client._http_internal = http

        bucket = client.lookup_bucket(
            BUCKET_NAME, if_metageneration_match=METAGENERATION_NUMBER
        )
        self.assertIsInstance(bucket, Bucket)
        self.assertEqual(bucket.name, BUCKET_NAME)
        http.request.assert_called_once_with(
            method="GET",
            url=mock.ANY,
            data=mock.ANY,
            headers=mock.ANY,
            timeout=self._get_default_timeout(),
        )
        _, kwargs = http.request.call_args
>       self.assertIn(kwargs.get("url"), (URI1, URI2))
E       AssertionError: 'https://storage.googleapis.com/storage/v1/b/bucket-name?projection=noAcl&ifMetagenerationMatch=6&prettyPrint=false' not found in ('https://storage.googleapis.com/storage/v1/b/bucket-name?projection=noAcl&ifMetagenerationMatch=6', 'https://storage.googleapis.com/storage/v1/b/bucket-name?ifMetagenerationMatch=6&projection=noAcl')

tests/unit/test_client.py:663: AssertionError

Seems prettyPrint is showing up? Confirmed same failures on master. @andrewsg

crwilcox changed the title fix: harden version data gathering against DistributionNotFound fix: use version.py for versioning, avoid issues with discovering version via get_distribution Oct 6, 2020

tseaver commented Oct 6, 2020
edited
Loading

Copy link
Copy Markdown
Contributor

@crwilcox &prettyPrint=False got added to URLs via https://www.github.com/googleapis/python-cloud-core/pull/28.

tseaver commented Oct 6, 2020
edited
Loading

Copy link
Copy Markdown
Contributor

We need to pull in @tswast's changes from #277 to get the tests to pass on latest google-cloud-core.

tseaver commented Oct 6, 2020

Copy link
Copy Markdown
Contributor

@crwilcox I just merged #277 to fix the tests on master.

crwilcox merged commit fcd1c4f into master Oct 6, 2020
tseaver deleted the guard-get-distribution branch August 24, 2021 18:07
cojenco pushed a commit to cojenco/python-storage that referenced this pull request Oct 13, 2021
…sion via get_distribution (googleapis#288)



Co-authored-by: Tres Seaver <tseaver@palladion.com>
cojenco pushed a commit to cojenco/python-storage that referenced this pull request Oct 13, 2021
…sion via get_distribution (googleapis#288)



Co-authored-by: Tres Seaver <tseaver@palladion.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL