KEMBAR78
Remove warnings in samples which appear in the Kokoro logs · Issue #1195 · googleapis/python-storage · GitHub
Skip to content

Remove warnings in samples which appear in the Kokoro logs #1195

@parthea

Description

@parthea
__________________________ test_storage_compose_file ___________________________

test_bucket = 

    def test_storage_compose_file(test_bucket):
        source_files = ["test_upload_blob_1", "test_upload_blob_2"]
        for source in source_files:
            blob = test_bucket.blob(source)
            blob.upload_from_string(source)
    
        with tempfile.NamedTemporaryFile() as dest_file:
            destination = storage_compose_file.compose_file(
                test_bucket.name,
                source_files[0],
                source_files[1],
                dest_file.name,
            )
>           composed = destination.download_as_string()
....
E       PendingDeprecationWarning: Blob.download_as_string() is deprecated and will be removed in future. Use Blob.download_as_bytes() instead.
________________________ ERROR at setup of test_get_rpo ________________________

    @pytest.fixture
    def dual_region_bucket():
        """Yields a dual region bucket that is deleted after the test completes."""
        bucket = None
        while bucket is None or bucket.exists():
            bucket_name = f"bucket-lock-{uuid.uuid4()}"
            bucket = storage.Client().bucket(bucket_name)
>           bucket.location = "NAM4"

rpo_test.py:33: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = 
value = 'NAM4'

    @location.setter
    def location(self, value):
        """(Deprecated) Set `Bucket.location`
    
        This can only be set at bucket **creation** time.
    
        See https://cloud.google.com/storage/docs/json_api/v1/buckets and
        https://cloud.google.com/storage/docs/bucket-locations
    
        .. warning::
    
            Assignment to 'Bucket.location' is deprecated, as it is only
            valid before the bucket is created. Instead, pass the location
            to `Bucket.create`.
        """
>       warnings.warn(_LOCATION_SETTER_MESSAGE, DeprecationWarning, stacklevel=2)
E       DeprecationWarning: Assignment to 'Bucket.location' is deprecated, as it is only valid before the bucket is created. Instead, pass the location to `Bucket.create`.

Metadata

Metadata

Assignees

Labels

api: storageIssues related to the googleapis/python-storage API.samplesIssues that are directly related to samples.type: cleanupAn internal cleanup or hygiene concern.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions