nox > Running session tests-3.11
nox > Creating virtual environment (virtualenv) using python3.11 in .nox/tests-3-11
nox > python -m pip install '.[dev]' h5netcdf netCDF4
nox > pytest
============================= test session starts ==============================
platform linux -- Python 3.11.13, pytest-8.4.1, pluggy-1.6.0
rootdir: /home/runner/work/lsapy/lsapy
configfile: pyproject.toml
testpaths: tests
plugins: nbval-0.11.0, anyio-4.10.0, cov-6.2.1
collected 85 items
tests/test_aggregate.py ..................... [ 24%]
tests/test_criteria.py ...... [ 31%]
tests/test_formatting.py .... [ 36%]
tests/test_functions.py ........................ [ 64%]
tests/test_lsa.py ........... [ 77%]
tests/test_membership_fitting.py .............. [ 94%]
tests/test_utils.py ....F [100%]
=================================== FAILURES ===================================
_________________________ TestOpenData.test_open_land __________________________
self = <test_utils.TestOpenData object at 0x7f0b07239050>
def test_open_land(self):
# all variables
> data = open_data("land")
^^^^^^^^^^^^^^^^^
tests/test_utils.py:53:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/lsapy/utils/_utils.py:126: in open_data
fnames = kuri().fetch(fname, processor=unpack)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.nox/tests-3-11/lib/python3.11/site-packages/pooch/core.py:589: in fetch
stream_download(
.nox/tests-3-11/lib/python3.11/site-packages/pooch/core.py:807: in stream_download
downloader(url, tmp, pooch)
.nox/tests-3-11/lib/python3.11/site-packages/pooch/downloaders.py:614: in __call__
data_repository = doi_to_repository(parsed_url["netloc"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.nox/tests-3-11/lib/python3.11/site-packages/pooch/downloaders.py:689: in doi_to_repository
archive_url = doi_to_url(doi)
^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
doi = '10.5281/zenodo.16249350'
def doi_to_url(doi):
"""
Follow a DOI link to resolve the URL of the archive.
Parameters
----------
doi : str
The DOI of the archive.
Returns
-------
url : str
The URL of the archive in the data repository.
"""
# Lazy import requests to speed up import time
import requests # pylint: disable=C0415
# Use doi.org to resolve the DOI to the repository website.
response = requests.get(f"https://doi.org/{doi}", timeout=DEFAULT_TIMEOUT)
url = response.url
if 400 <= response.status_code < 600:
> raise ValueError(
f"Archive with doi:{doi} not found (see {url}). Is the DOI correct?"
)
E ValueError: Archive with doi:10.5281/zenodo.16249350 not found (see https://zenodo.org/doi/10.5281/zenodo.16249350). Is the DOI correct?
.nox/tests-3-11/lib/python3.11/site-packages/pooch/downloaders.py:652: ValueError
----------------------------- Captured stderr call -----------------------------
Downloading file 'New-Zealand-Gridded-Land-Information-Dataset_NZ5km.nc' from 'doi:10.5281/zenodo.16249350/New-Zealand-Gridded-Land-Information-Dataset_NZ5km.nc' to '/home/runner/.cache/lsapy'.
=============================== warnings summary ===============================
tests/test_functions.py::TestVetharaniam22Eq5::test_negative
tests/test_membership_fitting.py::TestFitMembership::test_simple
/home/runner/work/lsapy/lsapy/src/lsapy/functions/membership.py:169: RuntimeWarning: invalid value encountered in sqrt
return 1 / (1 + np.exp(a * (np.sqrt(x) - np.sqrt(b))))
tests/test_functions.py::TestVetharaniam24Eq8::test_midpoint
/home/runner/work/lsapy/lsapy/src/lsapy/functions/membership.py:209: RuntimeWarning: divide by zero encountered in power
return np.exp(-a * np.power(x - b, c))
tests/test_functions.py::TestVetharaniam24Eq10::test_scaling
/home/runner/work/lsapy/lsapy/src/lsapy/functions/membership.py:249: RuntimeWarning: overflow encountered in exp
return 2 / (1 + np.exp(a * np.power(np.power(x, c) - np.power(b, c), 2)))
tests/test_membership_fitting.py: 7501 warnings
/home/runner/work/lsapy/lsapy/src/lsapy/functions/membership.py:249: RuntimeWarning: invalid value encountered in power
return 2 / (1 + np.exp(a * np.power(np.power(x, c) - np.power(b, c), 2)))
tests/test_utils.py::TestOpenData::test_open_climate
<frozen importlib._bootstrap>:241: RuntimeWarning: numpy.ndarray size changed, may indicate binary incompatibility. Expected 16 from C header, got 96 from PyObject
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_utils.py::TestOpenData::test_open_land - ValueError: Archive with doi:10.5281/zenodo.16249350 not found (see https://zenodo.org/doi/10.5281/zenodo.16249350). Is the DOI correct?
================= 1 failed, 84 passed, 7506 warnings in 6.60s ==================
nox > Command pytest failed with exit code 1
nox > Session tests-3.11 failed.
Error: Process completed with exit code 1.
Setup Information
Description
The
tests/test_utils.py::TestOpenData::test_open_landtest has been randomly failing across Python version and OS in CI for the past couple of days.Steps To Reproduce
No response
Additional Context
Here is the full traceback:
Contribution
Code of Conduct