Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-google-resumable-media for
openSUSE:Factory checked in at 2022-10-17 14:58:42
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-google-resumable-media (Old)
and /work/SRC/openSUSE:Factory/.python-google-resumable-media.new.2275
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-google-resumable-media"
Mon Oct 17 14:58:42 2022 rev:15 rq:1012096 version:2.4.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-google-resumable-media/python-google-resumable-media.changes
2022-06-10 15:58:00.864855501 +0200
+++
/work/SRC/openSUSE:Factory/.python-google-resumable-media.new.2275/python-google-resumable-media.changes
2022-10-17 14:58:45.810215323 +0200
@@ -1,0 +2,15 @@
+Mon Oct 17 09:39:25 UTC 2022 - John Paul Adrian Glaubitz
<[email protected]>
+
+- Update to 2.4.0
+ Features
+ * Handle interrupted downloads with decompressive transcoding (#346)
+ Bug Fixes
+ * Allow recover to check the status of upload regardless of state (#343)
+ * Require python 3.7+ (#337) (942665f)
+ * Use unittest.mock (#329) (82f9769)
+ Documentation
+ * Fix changelog header to consistent size (#331) (7b1dc9c)
+- Refresh patches for new version
+ * python-google-resumable-media-no-mock.patch
+
+-------------------------------------------------------------------
Old:
----
google-resumable-media-2.3.3.tar.gz
New:
----
google-resumable-media-2.4.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-google-resumable-media.spec ++++++
--- /var/tmp/diff_new_pack.Bjlmgw/_old 2022-10-17 14:58:46.494216638 +0200
+++ /var/tmp/diff_new_pack.Bjlmgw/_new 2022-10-17 14:58:46.498216646 +0200
@@ -19,7 +19,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-google-resumable-media
-Version: 2.3.3
+Version: 2.4.0
Release: 0
Summary: Utilities for Google Media Downloads and Resumable Uploads
License: Apache-2.0
++++++ google-resumable-media-2.3.3.tar.gz ->
google-resumable-media-2.4.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/google-resumable-media-2.3.3/PKG-INFO
new/google-resumable-media-2.4.0/PKG-INFO
--- old/google-resumable-media-2.3.3/PKG-INFO 2022-05-19 14:44:35.157641600
+0200
+++ new/google-resumable-media-2.4.0/PKG-INFO 2022-09-29 23:58:29.030800000
+0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: google-resumable-media
-Version: 2.3.3
+Version: 2.4.0
Summary: Utilities for Google Media Downloads and Resumable Uploads
Home-page: https://github.com/googleapis/google-resumable-media-python
Author: Google Cloud Platform
@@ -12,13 +12,12 @@
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Topic :: Internet
-Requires-Python: >= 3.6
+Requires-Python: >= 3.7
Provides-Extra: requests
Provides-Extra: aiohttp
License-File: LICENSE
@@ -41,16 +40,19 @@
Supported Python Versions
-------------------------
-Python >= 3.6
+Python >= 3.7
Unsupported Python Versions
---------------------------
-Python == 2.7, Python == 3.5.
+Python == 2.7, Python == 3.5, Python == 3.6.
The last version of this library compatible with Python 2.7 and 3.5 is
`google-resumable-media==1.3.3`.
+The last version of this library compatible with Python 3.6 is
+`google-resumable-media==2.3.3`.
+
License
-------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/google-resumable-media-2.3.3/README.rst
new/google-resumable-media-2.4.0/README.rst
--- old/google-resumable-media-2.3.3/README.rst 2022-05-19 14:42:00.000000000
+0200
+++ new/google-resumable-media-2.4.0/README.rst 2022-09-29 23:54:59.000000000
+0200
@@ -16,16 +16,19 @@
Supported Python Versions
-------------------------
-Python >= 3.6
+Python >= 3.7
Unsupported Python Versions
---------------------------
-Python == 2.7, Python == 3.5.
+Python == 2.7, Python == 3.5, Python == 3.6.
The last version of this library compatible with Python 2.7 and 3.5 is
`google-resumable-media==1.3.3`.
+The last version of this library compatible with Python 3.6 is
+`google-resumable-media==2.3.3`.
+
License
-------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/google-resumable-media-2.3.3/google/resumable_media/_helpers.py
new/google-resumable-media-2.4.0/google/resumable_media/_helpers.py
--- old/google-resumable-media-2.3.3/google/resumable_media/_helpers.py
2022-05-19 14:42:00.000000000 +0200
+++ new/google-resumable-media-2.4.0/google/resumable_media/_helpers.py
2022-09-29 23:54:59.000000000 +0200
@@ -32,6 +32,7 @@
RANGE_HEADER = "range"
CONTENT_RANGE_HEADER = "content-range"
+CONTENT_ENCODING_HEADER = "content-encoding"
_SLOW_CRC32C_WARNING = (
"Currently using crcmod in pure python form. This is a slow "
@@ -40,6 +41,8 @@
)
_GENERATION_HEADER = "x-goog-generation"
_HASH_HEADER = "x-goog-hash"
+_STORED_CONTENT_ENCODING_HEADER = "x-goog-stored-content-encoding"
+
_MISSING_CHECKSUM = """\
No {checksum_type} checksum was returned from the service while downloading {}
(which happens for composite objects), so client-side content integrity
@@ -369,6 +372,23 @@
return urlunsplit((scheme, netloc, path, query, frag))
+def _is_decompressive_transcoding(response, get_headers):
+ """Returns True if the object was served decompressed. This happens when
the
+ "x-goog-stored-content-encoding" header is "gzip" and "content-encoding"
header
+ is not "gzip". See more at:
https://cloud.google.com/storage/docs/transcoding#transcoding_and_gzip
+ Args:
+ response (~requests.Response): The HTTP response object.
+ get_headers (callable: response->dict): returns response headers.
+ Returns:
+ bool: Returns True if decompressive transcoding has occurred;
otherwise, False.
+ """
+ headers = get_headers(response)
+ return (
+ headers.get(_STORED_CONTENT_ENCODING_HEADER) == "gzip"
+ and headers.get(CONTENT_ENCODING_HEADER) != "gzip"
+ )
+
+
class _DoNothingHash(object):
"""Do-nothing hash object.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/google-resumable-media-2.3.3/google/resumable_media/_upload.py
new/google-resumable-media-2.4.0/google/resumable_media/_upload.py
--- old/google-resumable-media-2.3.3/google/resumable_media/_upload.py
2022-05-19 14:42:00.000000000 +0200
+++ new/google-resumable-media-2.4.0/google/resumable_media/_upload.py
2022-09-29 23:54:59.000000000 +0200
@@ -794,14 +794,8 @@
The headers **do not** incorporate the ``_headers`` on the
current instance.
- Raises:
- ValueError: If the current upload is not in an invalid state.
-
.. _sans-I/O: https://sans-io.readthedocs.io/
"""
- if not self.invalid:
- raise ValueError("Upload is not in invalid state, no need to
recover.")
-
headers = {_helpers.CONTENT_RANGE_HEADER: "bytes */*"}
return _PUT, self.resumable_url, None, headers
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/google-resumable-media-2.3.3/google/resumable_media/requests/__init__.py
new/google-resumable-media-2.4.0/google/resumable_media/requests/__init__.py
---
old/google-resumable-media-2.3.3/google/resumable_media/requests/__init__.py
2022-05-19 14:42:00.000000000 +0200
+++
new/google-resumable-media-2.4.0/google/resumable_media/requests/__init__.py
2022-09-29 23:54:59.000000000 +0200
@@ -631,7 +631,7 @@
>>> response0 = upload.transmit_next_chunk(transport)
>>> response0
- <Response [HTTPStatus.PERMANENT_REDIRECT]>
+ <Response [308]>
>>> upload.finished
False
>>> upload.bytes_uploaded == upload.chunk_size
@@ -639,7 +639,7 @@
>>>
>>> response1 = upload.transmit_next_chunk(transport)
>>> response1
- <Response [HTTPStatus.PERMANENT_REDIRECT]>
+ <Response [308]>
>>> upload.finished
False
>>> upload.bytes_uploaded == 2 * upload.chunk_size
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/google-resumable-media-2.3.3/google/resumable_media/requests/download.py
new/google-resumable-media-2.4.0/google/resumable_media/requests/download.py
---
old/google-resumable-media-2.3.3/google/resumable_media/requests/download.py
2022-05-19 14:42:00.000000000 +0200
+++
new/google-resumable-media-2.4.0/google/resumable_media/requests/download.py
2022-09-29 23:54:59.000000000 +0200
@@ -36,6 +36,13 @@
{}
"""
+_STREAM_SEEK_ERROR = """\
+Incomplete download for:
+{}
+Error writing to stream while handling a gzip-compressed file download.
+Please restart the download.
+"""
+
class Download(_request_helpers.RequestsMixin, _download.Download):
"""Helper to manage downloading a resource from a Google API.
@@ -206,7 +213,18 @@
self._process_response(result)
+ # With decompressive transcoding, GCS serves back the whole file
regardless of the range request,
+ # thus we reset the stream position to the start of the stream.
+ # See: https://cloud.google.com/storage/docs/transcoding#range
if self._stream is not None:
+ if _helpers._is_decompressive_transcoding(result,
self._get_headers):
+ try:
+ self._stream.seek(0)
+ except Exception as exc:
+ msg = _STREAM_SEEK_ERROR.format(url)
+ raise Exception(msg) from exc
+ self._bytes_downloaded = 0
+
self._write_to_stream(result)
return result
@@ -379,7 +397,18 @@
self._process_response(result)
+ # With decompressive transcoding, GCS serves back the whole file
regardless of the range request,
+ # thus we reset the stream position to the start of the stream.
+ # See: https://cloud.google.com/storage/docs/transcoding#range
if self._stream is not None:
+ if _helpers._is_decompressive_transcoding(result,
self._get_headers):
+ try:
+ self._stream.seek(0)
+ except Exception as exc:
+ msg = _STREAM_SEEK_ERROR.format(url)
+ raise Exception(msg) from exc
+ self._bytes_downloaded = 0
+
self._write_to_stream(result)
return result
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/google-resumable-media-2.3.3/google/resumable_media/requests/upload.py
new/google-resumable-media-2.4.0/google/resumable_media/requests/upload.py
--- old/google-resumable-media-2.3.3/google/resumable_media/requests/upload.py
2022-05-19 14:42:00.000000000 +0200
+++ new/google-resumable-media-2.4.0/google/resumable_media/requests/upload.py
2022-09-29 23:54:59.000000000 +0200
@@ -517,14 +517,15 @@
)
def recover(self, transport):
- """Recover from a failure.
-
- This method should be used when a :class:`ResumableUpload` is in an
- :attr:`~ResumableUpload.invalid` state due to a request failure.
+ """Recover from a failure and check the status of the current upload.
This will verify the progress with the server and make sure the
current upload is in a valid state before :meth:`transmit_next_chunk`
- can be used again.
+ can be used again. See
https://cloud.google.com/storage/docs/performing-resumable-uploads#status-check
+ for more information.
+
+ This method can be used when a :class:`ResumableUpload` is in an
+ :attr:`~ResumableUpload.invalid` state due to a request failure.
Args:
transport (~requests.Session): A ``requests`` object which can
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/google-resumable-media-2.3.3/google_resumable_media.egg-info/PKG-INFO
new/google-resumable-media-2.4.0/google_resumable_media.egg-info/PKG-INFO
--- old/google-resumable-media-2.3.3/google_resumable_media.egg-info/PKG-INFO
2022-05-19 14:44:34.000000000 +0200
+++ new/google-resumable-media-2.4.0/google_resumable_media.egg-info/PKG-INFO
2022-09-29 23:58:28.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: google-resumable-media
-Version: 2.3.3
+Version: 2.4.0
Summary: Utilities for Google Media Downloads and Resumable Uploads
Home-page: https://github.com/googleapis/google-resumable-media-python
Author: Google Cloud Platform
@@ -12,13 +12,12 @@
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Topic :: Internet
-Requires-Python: >= 3.6
+Requires-Python: >= 3.7
Provides-Extra: requests
Provides-Extra: aiohttp
License-File: LICENSE
@@ -41,16 +40,19 @@
Supported Python Versions
-------------------------
-Python >= 3.6
+Python >= 3.7
Unsupported Python Versions
---------------------------
-Python == 2.7, Python == 3.5.
+Python == 2.7, Python == 3.5, Python == 3.6.
The last version of this library compatible with Python 2.7 and 3.5 is
`google-resumable-media==1.3.3`.
+The last version of this library compatible with Python 3.6 is
+`google-resumable-media==2.3.3`.
+
License
-------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/google-resumable-media-2.3.3/setup.py
new/google-resumable-media-2.4.0/setup.py
--- old/google-resumable-media-2.3.3/setup.py 2022-05-19 14:42:00.000000000
+0200
+++ new/google-resumable-media-2.4.0/setup.py 2022-09-29 23:54:59.000000000
+0200
@@ -35,7 +35,7 @@
setuptools.setup(
name='google-resumable-media',
- version = "2.3.3",
+ version = "2.4.0",
description='Utilities for Google Media Downloads and Resumable Uploads',
author='Google Cloud Platform',
author_email='[email protected]',
@@ -50,14 +50,13 @@
zip_safe=False,
install_requires=REQUIREMENTS,
extras_require=EXTRAS_REQUIRE,
- python_requires='>= 3.6',
+ python_requires='>= 3.7',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/google-resumable-media-2.3.3/tests/system/requests/test_download.py
new/google-resumable-media-2.4.0/tests/system/requests/test_download.py
--- old/google-resumable-media-2.3.3/tests/system/requests/test_download.py
2022-05-19 14:42:00.000000000 +0200
+++ new/google-resumable-media-2.4.0/tests/system/requests/test_download.py
2022-09-29 23:54:59.000000000 +0200
@@ -294,6 +294,26 @@
assert stream.getvalue() == actual_contents
check_tombstoned(download, authorized_transport)
+ def test_download_gzip_w_stored_content_headers(
+ self, add_files, authorized_transport
+ ):
+ # Retrieve the gzip compressed file
+ info = ALL_FILES[-1]
+ actual_contents = self._get_contents(info)
+ blob_name = get_blob_name(info)
+
+ # Create the actual download object.
+ media_url = utils.DOWNLOAD_URL_TEMPLATE.format(blob_name=blob_name)
+ stream = io.BytesIO()
+ download = self._make_one(media_url, stream=stream)
+ # Consume the resource.
+ response = download.consume(authorized_transport)
+ assert response.status_code == http.client.OK
+ assert response.headers.get(_helpers._STORED_CONTENT_ENCODING_HEADER)
== "gzip"
+ assert response.headers.get("X-Goog-Stored-Content-Length") is not None
+ assert stream.getvalue() == actual_contents
+ check_tombstoned(download, authorized_transport)
+
def test_extra_headers(self, authorized_transport, secret_file):
blob_name, data, headers = secret_file
# Create the actual download object.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/google-resumable-media-2.3.3/tests/system/requests/test_upload.py
new/google-resumable-media-2.4.0/tests/system/requests/test_upload.py
--- old/google-resumable-media-2.3.3/tests/system/requests/test_upload.py
2022-05-19 14:42:00.000000000 +0200
+++ new/google-resumable-media-2.4.0/tests/system/requests/test_upload.py
2022-09-29 23:54:59.000000000 +0200
@@ -20,7 +20,7 @@
import urllib.parse
import pytest # type: ignore
-import mock
+from unittest import mock
from google.resumable_media import common
from google import resumable_media
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/google-resumable-media-2.3.3/tests/unit/requests/test__helpers.py
new/google-resumable-media-2.4.0/tests/unit/requests/test__helpers.py
--- old/google-resumable-media-2.3.3/tests/unit/requests/test__helpers.py
2022-05-19 14:42:00.000000000 +0200
+++ new/google-resumable-media-2.4.0/tests/unit/requests/test__helpers.py
2022-09-29 23:54:59.000000000 +0200
@@ -14,7 +14,7 @@
import http.client
-import mock
+from unittest import mock
import pytest # type: ignore
import requests.exceptions
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/google-resumable-media-2.3.3/tests/unit/requests/test_download.py
new/google-resumable-media-2.4.0/tests/unit/requests/test_download.py
--- old/google-resumable-media-2.3.3/tests/unit/requests/test_download.py
2022-05-19 14:42:00.000000000 +0200
+++ new/google-resumable-media-2.4.0/tests/unit/requests/test_download.py
2022-09-29 23:54:59.000000000 +0200
@@ -15,7 +15,7 @@
import http.client
import io
-import mock
+from unittest import mock
import pytest # type: ignore
from google.resumable_media import common
@@ -395,6 +395,45 @@
range_bytes = "bytes={:d}-{:d}".format(offset, end)
assert download._headers["range"] == range_bytes
+ def test_consume_gzip_reset_stream_w_bytes_downloaded(self):
+ stream = io.BytesIO()
+ chunks = (b"up down ", b"charlie ", b"brown")
+ end = 65536
+
+ download = download_mod.Download(
+ EXAMPLE_URL, stream=stream, end=end, headers=None, checksum="md5"
+ )
+ transport = mock.Mock(spec=["request"])
+
+ # Mock a decompressive transcoding retry operation with bytes already
downloaded in the stream
+ headers = {_helpers._STORED_CONTENT_ENCODING_HEADER: "gzip"}
+ transport.request.return_value = _mock_response(chunks=chunks,
headers=headers)
+ offset = 16
+ download._bytes_downloaded = offset
+ download.consume(transport)
+
+ assert stream.getvalue() == b"".join(chunks)
+ assert download._bytes_downloaded == len(b"".join(chunks))
+
+ def test_consume_gzip_reset_stream_error(self):
+ stream = io.BytesIO()
+ chunks = (b"up down ", b"charlie ", b"brown")
+ end = 65536
+
+ download = download_mod.Download(
+ EXAMPLE_URL, stream=stream, end=end, headers=None, checksum="md5"
+ )
+ transport = mock.Mock(spec=["request"])
+
+ # Mock a stream seek error while resuming a decompressive transcoding
download
+ stream.seek = mock.Mock(side_effect=OSError("mock stream seek error"))
+ headers = {_helpers._STORED_CONTENT_ENCODING_HEADER: "gzip"}
+ transport.request.return_value = _mock_response(chunks=chunks,
headers=headers)
+ offset = 16
+ download._bytes_downloaded = offset
+ with pytest.raises(Exception):
+ download.consume(transport)
+
class TestRawDownload(object):
def test__write_to_stream_no_hash_check(self):
@@ -772,6 +811,49 @@
range_bytes = "bytes={:d}-{:d}".format(offset, end)
assert download._headers["range"] == range_bytes
+ def test_consume_gzip_reset_stream_w_bytes_downloaded(self):
+ stream = io.BytesIO()
+ chunks = (b"up down ", b"charlie ", b"brown")
+ end = 65536
+
+ download = download_mod.RawDownload(
+ EXAMPLE_URL, stream=stream, end=end, headers=None, checksum="md5"
+ )
+ transport = mock.Mock(spec=["request"])
+
+ # Mock a decompressive transcoding retry operation with bytes already
downloaded in the stream
+ headers = {_helpers._STORED_CONTENT_ENCODING_HEADER: "gzip"}
+ transport.request.return_value = _mock_raw_response(
+ chunks=chunks, headers=headers
+ )
+ offset = 16
+ download._bytes_downloaded = offset
+ download.consume(transport)
+
+ assert stream.getvalue() == b"".join(chunks)
+ assert download._bytes_downloaded == len(b"".join(chunks))
+
+ def test_consume_gzip_reset_stream_error(self):
+ stream = io.BytesIO()
+ chunks = (b"up down ", b"charlie ", b"brown")
+ end = 65536
+
+ download = download_mod.RawDownload(
+ EXAMPLE_URL, stream=stream, end=end, headers=None, checksum="md5"
+ )
+ transport = mock.Mock(spec=["request"])
+
+ # Mock a stream seek error while resuming a decompressive transcoding
download
+ stream.seek = mock.Mock(side_effect=OSError("mock stream seek error"))
+ headers = {_helpers._STORED_CONTENT_ENCODING_HEADER: "gzip"}
+ transport.request.return_value = _mock_raw_response(
+ chunks=chunks, headers=headers
+ )
+ offset = 16
+ download._bytes_downloaded = offset
+ with pytest.raises(Exception):
+ download.consume(transport)
+
class TestChunkedDownload(object):
@staticmethod
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/google-resumable-media-2.3.3/tests/unit/requests/test_upload.py
new/google-resumable-media-2.4.0/tests/unit/requests/test_upload.py
--- old/google-resumable-media-2.3.3/tests/unit/requests/test_upload.py
2022-05-19 14:42:00.000000000 +0200
+++ new/google-resumable-media-2.4.0/tests/unit/requests/test_upload.py
2022-09-29 23:54:59.000000000 +0200
@@ -16,7 +16,7 @@
import io
import json
-import mock
+from unittest import mock
import google.resumable_media.requests.upload as upload_mod
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/google-resumable-media-2.3.3/tests/unit/test__download.py
new/google-resumable-media-2.4.0/tests/unit/test__download.py
--- old/google-resumable-media-2.3.3/tests/unit/test__download.py
2022-05-19 14:42:00.000000000 +0200
+++ new/google-resumable-media-2.4.0/tests/unit/test__download.py
2022-09-29 23:54:59.000000000 +0200
@@ -15,7 +15,7 @@
import http.client
import io
-import mock
+from unittest import mock
import pytest # type: ignore
from google.resumable_media import _download
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/google-resumable-media-2.3.3/tests/unit/test__helpers.py
new/google-resumable-media-2.4.0/tests/unit/test__helpers.py
--- old/google-resumable-media-2.3.3/tests/unit/test__helpers.py
2022-05-19 14:42:00.000000000 +0200
+++ new/google-resumable-media-2.4.0/tests/unit/test__helpers.py
2022-09-29 23:54:59.000000000 +0200
@@ -17,7 +17,7 @@
import hashlib
import http.client
-import mock
+from unittest import mock
import pytest # type: ignore
from google.resumable_media import _helpers
@@ -425,6 +425,31 @@
assert generation_header == self.GENERATION_VALUE
+class Test__is_decompressive_transcoding(object):
+ def test_empty_value(self):
+ headers = {}
+ response = _mock_response(headers=headers)
+ assert _helpers._is_decompressive_transcoding(response, _get_headers)
is False
+
+ def test_gzip_in_headers(self):
+ headers = {_helpers._STORED_CONTENT_ENCODING_HEADER: "gzip"}
+ response = _mock_response(headers=headers)
+ assert _helpers._is_decompressive_transcoding(response, _get_headers)
is True
+
+ def test_gzip_not_in_headers(self):
+ headers = {_helpers._STORED_CONTENT_ENCODING_HEADER: "identity"}
+ response = _mock_response(headers=headers)
+ assert _helpers._is_decompressive_transcoding(response, _get_headers)
is False
+
+ def test_gzip_w_content_encoding_in_headers(self):
+ headers = {
+ _helpers._STORED_CONTENT_ENCODING_HEADER: "gzip",
+ _helpers.CONTENT_ENCODING_HEADER: "gzip",
+ }
+ response = _mock_response(headers=headers)
+ assert _helpers._is_decompressive_transcoding(response, _get_headers)
is False
+
+
class Test__get_generation_from_url(object):
GENERATION_VALUE = 1641590104888641
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/google-resumable-media-2.3.3/tests/unit/test__upload.py
new/google-resumable-media-2.4.0/tests/unit/test__upload.py
--- old/google-resumable-media-2.3.3/tests/unit/test__upload.py 2022-05-19
14:42:00.000000000 +0200
+++ new/google-resumable-media-2.4.0/tests/unit/test__upload.py 2022-09-29
23:54:59.000000000 +0200
@@ -16,7 +16,7 @@
import io
import sys
-import mock
+from unittest import mock
import pytest # type: ignore
from google.resumable_media import _helpers
@@ -951,8 +951,13 @@
upload = _upload.ResumableUpload(RESUMABLE_URL, ONE_MB)
assert not upload.invalid
- with pytest.raises(ValueError):
- upload._prepare_recover_request()
+ method, url, payload, headers = upload._prepare_recover_request()
+ assert method == "PUT"
+ assert url == upload.resumable_url
+ assert payload is None
+ assert headers == {"content-range": "bytes */*"}
+ # Make sure headers are untouched.
+ assert upload._headers == {}
def test__prepare_recover_request(self):
upload = _upload.ResumableUpload(RESUMABLE_URL, ONE_MB)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/google-resumable-media-2.3.3/tests/unit/test_common.py
new/google-resumable-media-2.4.0/tests/unit/test_common.py
--- old/google-resumable-media-2.3.3/tests/unit/test_common.py 2022-05-19
14:42:00.000000000 +0200
+++ new/google-resumable-media-2.4.0/tests/unit/test_common.py 2022-09-29
23:54:59.000000000 +0200
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import mock
+from unittest import mock
import pytest # type: ignore
from google.resumable_media import common
++++++ python-google-resumable-media-no-mock.patch ++++++
--- /var/tmp/diff_new_pack.Bjlmgw/_old 2022-10-17 14:58:46.630216899 +0200
+++ /var/tmp/diff_new_pack.Bjlmgw/_new 2022-10-17 14:58:46.634216907 +0200
@@ -1,106 +1,3 @@
-diff --git a/tests/system/requests/test_upload.py
b/tests/system/requests/test_upload.py
-index 3dc92077..6f6991e8 100644
---- a/tests/system/requests/test_upload.py
-+++ b/tests/system/requests/test_upload.py
-@@ -20,7 +20,7 @@
- import urllib.parse
-
- import pytest # type: ignore
--import mock
-+from unittest import mock
-
- from google.resumable_media import common
- from google import resumable_media
-diff --git a/tests/unit/requests/test__helpers.py
b/tests/unit/requests/test__helpers.py
-index 0d4c7d17..dc940f2c 100644
---- a/tests/unit/requests/test__helpers.py
-+++ b/tests/unit/requests/test__helpers.py
-@@ -14,7 +14,7 @@
-
- import http.client
-
--import mock
-+from unittest import mock
- import pytest # type: ignore
-
- import requests.exceptions
-diff --git a/tests/unit/requests/test_download.py
b/tests/unit/requests/test_download.py
-index 210973d7..ace0df7c 100644
---- a/tests/unit/requests/test_download.py
-+++ b/tests/unit/requests/test_download.py
-@@ -15,7 +15,7 @@
- import http.client
- import io
-
--import mock
-+from unittest import mock
- import pytest # type: ignore
-
- from google.resumable_media import common
-diff --git a/tests/unit/requests/test_upload.py
b/tests/unit/requests/test_upload.py
-index 3694c750..231bec85 100644
---- a/tests/unit/requests/test_upload.py
-+++ b/tests/unit/requests/test_upload.py
-@@ -16,7 +16,7 @@
- import io
- import json
-
--import mock
-+from unittest import mock
-
- import google.resumable_media.requests.upload as upload_mod
-
-diff --git a/tests/unit/test__download.py b/tests/unit/test__download.py
-index 46026b16..21a232eb 100644
---- a/tests/unit/test__download.py
-+++ b/tests/unit/test__download.py
-@@ -15,7 +15,7 @@
- import http.client
- import io
-
--import mock
-+from unittest import mock
- import pytest # type: ignore
-
- from google.resumable_media import _download
-diff --git a/tests/unit/test__helpers.py b/tests/unit/test__helpers.py
-index feedeb18..0bfbae42 100644
---- a/tests/unit/test__helpers.py
-+++ b/tests/unit/test__helpers.py
-@@ -17,7 +17,7 @@
- import hashlib
- import http.client
-
--import mock
-+from unittest import mock
- import pytest # type: ignore
-
- from google.resumable_media import _helpers
-diff --git a/tests/unit/test__upload.py b/tests/unit/test__upload.py
-index d5f82089..110ed775 100644
---- a/tests/unit/test__upload.py
-+++ b/tests/unit/test__upload.py
-@@ -16,7 +16,7 @@
- import io
- import sys
-
--import mock
-+from unittest import mock
- import pytest # type: ignore
-
- from google.resumable_media import _helpers
-diff --git a/tests/unit/test_common.py b/tests/unit/test_common.py
-index a8572bea..d96840c1 100644
---- a/tests/unit/test_common.py
-+++ b/tests/unit/test_common.py
-@@ -12,7 +12,7 @@
- # See the License for the specific language governing permissions and
- # limitations under the License.
-
--import mock
-+from unittest import mock
- import pytest # type: ignore
-
- from google.resumable_media import common
+(No newline at EOF)