changelog: amend deprecated section #1048
GitHub Actions / Petals / Unit Test Results (3.10)
failed
Nov 4, 2024 in 0s
1 fail, 2 skipped, 200 pass in 4m 24s
Annotations
Check warning on line 0 in climada_petals.hazard.test.test_drought.TestReader
github-actions / Petals / Unit Test Results (3.10)
test (climada_petals.hazard.test.test_drought.TestReader) failed
climada_petals/tests_xml/tests.xml [took 30s]
Raw output
requests.exceptions.ChunkedEncodingError: Importing the SPEI data file failed: ('Connection broken: IncompleteRead(264744514 bytes read, 94720615 more expected)', IncompleteRead(264744514 bytes read, 94720615 more expected))
self = <urllib3.response.HTTPResponse object at 0x7f7dc6f38ee0>
@contextmanager
def _error_catcher(self) -> typing.Generator[None, None, None]:
"""
Catch low-level python exceptions, instead re-raising urllib3
variants, so that low-level exceptions are not leaked in the
high-level api.
On exit, release the connection back to the pool.
"""
clean_exit = False
try:
try:
> yield
../../../../micromamba/envs/climada_env_3.10/lib/python3.10/site-packages/urllib3/response.py:748:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <urllib3.response.HTTPResponse object at 0x7f7dc6f38ee0>, amt = 1024
def _raw_read(
self,
amt: int | None = None,
*,
read1: bool = False,
) -> bytes:
"""
Reads `amt` of bytes from the socket.
"""
if self._fp is None:
return None # type: ignore[return-value]
fp_closed = getattr(self._fp, "closed", False)
with self._error_catcher():
data = self._fp_read(amt, read1=read1) if not fp_closed else b""
if amt is not None and amt != 0 and not data:
# Platform-specific: Buggy versions of Python.
# Close the connection when no data is returned
#
# This is redundant to what httplib/http.client _should_
# already do. However, versions of python released before
# December 15, 2012 (http://bugs.python.org/issue16298) do
# not properly close the connection in all cases. There is
# no harm in redundantly calling close.
self._fp.close()
if (
self.enforce_content_length
and self.length_remaining is not None
and self.length_remaining != 0
):
# This is an edge case that httplib failed to cover due
# to concerns of backward compatibility. We're
# addressing it here to make sure IncompleteRead is
# raised during streaming, so all calls with incorrect
# Content-Length are caught.
> raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
E urllib3.exceptions.IncompleteRead: IncompleteRead(264744514 bytes read, 94720615 more expected)
../../../../micromamba/envs/climada_env_3.10/lib/python3.10/site-packages/urllib3/response.py:894: IncompleteRead
The above exception was the direct cause of the following exception:
def generate():
# Special case for urllib3.
if hasattr(self.raw, "stream"):
try:
> yield from self.raw.stream(chunk_size, decode_content=True)
../../../../micromamba/envs/climada_env_3.10/lib/python3.10/site-packages/requests/models.py:820:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../../micromamba/envs/climada_env_3.10/lib/python3.10/site-packages/urllib3/response.py:1060: in stream
data = self.read(amt=amt, decode_content=decode_content)
../../../../micromamba/envs/climada_env_3.10/lib/python3.10/site-packages/urllib3/response.py:977: in read
data = self._raw_read(amt)
../../../../micromamba/envs/climada_env_3.10/lib/python3.10/site-packages/urllib3/response.py:872: in _raw_read
with self._error_catcher():
../../../../micromamba/envs/climada_env_3.10/lib/python3.10/contextlib.py:153: in __exit__
self.gen.throw(typ, value, traceback)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <urllib3.response.HTTPResponse object at 0x7f7dc6f38ee0>
@contextmanager
def _error_catcher(self) -> typing.Generator[None, None, None]:
"""
Catch low-level python exceptions, instead re-raising urllib3
variants, so that low-level exceptions are not leaked in the
high-level api.
On exit, release the connection back to the pool.
"""
clean_exit = False
try:
try:
yield
except SocketTimeout as e:
# FIXME: Ideally we'd like to include the url in the ReadTimeoutError but
# there is yet no clean way to get at it from this context.
raise ReadTimeoutError(self._pool, None, "Read timed out.") from e # type: ignore[arg-type]
except BaseSSLError as e:
# FIXME: Is there a better way to differentiate between SSLErrors?
if "read operation timed out" not in str(e):
# SSL errors related to framing/MAC get wrapped and reraised here
raise SSLError(e) from e
raise ReadTimeoutError(self._pool, None, "Read timed out.") from e # type: ignore[arg-type]
except IncompleteRead as e:
if (
e.expected is not None
and e.partial is not None
and e.expected == -e.partial
):
arg = "Response may not contain content."
else:
arg = f"Connection broken: {e!r}"
> raise ProtocolError(arg, e) from e
E urllib3.exceptions.ProtocolError: ('Connection broken: IncompleteRead(264744514 bytes read, 94720615 more expected)', IncompleteRead(264744514 bytes read, 94720615 more expected))
../../../../micromamba/envs/climada_env_3.10/lib/python3.10/site-packages/urllib3/response.py:772: ProtocolError
During handling of the above exception, another exception occurred:
self = <climada_petals.hazard.drought.Drought object at 0x7f7dc7044d60>
def setup(self):
"""Set up the hazard drought"""
try:
if not self.file_path.is_file():
> download_file(SPEI_FILE_URL, download_dir=SPEI_FILE_DIR)
climada_petals/hazard/drought.py:134:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../../micromamba/envs/climada_env_3.10/lib/python3.10/site-packages/climada/util/files_handler.py:108: in download_file
for data in tqdm(
../../../../micromamba/envs/climada_env_3.10/lib/python3.10/site-packages/tqdm/std.py:1181: in __iter__
for obj in iterable:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def generate():
# Special case for urllib3.
if hasattr(self.raw, "stream"):
try:
yield from self.raw.stream(chunk_size, decode_content=True)
except ProtocolError as e:
> raise ChunkedEncodingError(e)
E requests.exceptions.ChunkedEncodingError: ('Connection broken: IncompleteRead(264744514 bytes read, 94720615 more expected)', IncompleteRead(264744514 bytes read, 94720615 more expected))
../../../../micromamba/envs/climada_env_3.10/lib/python3.10/site-packages/requests/models.py:822: ChunkedEncodingError
The above exception was the direct cause of the following exception:
self = <climada_petals.hazard.test.test_drought.TestReader testMethod=test>
def test(self):
drought = Drought()
drought.set_area(44.5, 5, 50, 12)
> hazard_set = drought.setup()
climada_petals/hazard/test/test_drought.py:34:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <climada_petals.hazard.drought.Drought object at 0x7f7dc7044d60>
def setup(self):
"""Set up the hazard drought"""
try:
if not self.file_path.is_file():
download_file(SPEI_FILE_URL, download_dir=SPEI_FILE_DIR)
LOGGER.debug('Importing %s', str(SPEI_FILE_NAME))
dataset = xr.open_dataset(self.file_path)
except Exception as err:
> raise type(err)('Importing the SPEI data file failed: ' + str(err)) from err
E requests.exceptions.ChunkedEncodingError: Importing the SPEI data file failed: ('Connection broken: IncompleteRead(264744514 bytes read, 94720615 more expected)', IncompleteRead(264744514 bytes read, 94720615 more expected))
climada_petals/hazard/drought.py:140: ChunkedEncodingError
Loading