Source: spectral-cube Version: 0.6.5-6 Severity: serious Tags: patch Justification: ftbfs Forwarded: https://github.com/radio-astro-tools/spectral-cube/issues/935
spectral-cube FTBFS in unstable due to a change somewhere between python3-dask 2024.5.2+dfsg-1 and 2024.12.1+dfsg-1. (This dask upload and the associated dask.distributed upload fix four other RC bugs between them, so I'm keen to get them into testing.) Here's the test log: I: pybuild base:311: cd /build/reproducible-path/spectral-cube-0.6.5/.pybuild/cpython3_3.13_spectral-cube/build; python3.13 -m pytest ============================= test session starts ============================== platform linux -- Python 3.13.1, pytest-8.3.4, pluggy-1.5.0 rootdir: /build/reproducible-path/spectral-cube-0.6.5 configfile: setup.cfg plugins: doctestplus-1.3.0, astropy-header-0.2.2, arraydiff-0.6.1, astropy-0.11.0, remotedata-0.4.1, mock-3.14.0, filter-subpackage-0.2.0, typeguard-4.4.1, hypothesis-6.122.1, cov-5.0.0 collected 1719 items spectral_cube/spectral_axis.py . [ 0%] spectral_cube/tests/test_analysis_functions.py ................... [ 1%] spectral_cube/tests/test_casafuncs.py ......sssssssssssssss [ 2%] spectral_cube/tests/test_cube_utils.py ....... [ 2%] spectral_cube/tests/test_dask.py .s..s.......s [ 3%] spectral_cube/tests/test_io.py ....................... [ 4%] spectral_cube/tests/test_masks.py ...................................... [ 7%] ...............................................XX.... [ 10%] spectral_cube/tests/test_moments.py .................................... [ 12%] ........................................................................ [ 16%] ........................................................................ [ 20%] ........ [ 21%] spectral_cube/tests/test_performance.py ...s.. [ 21%] spectral_cube/tests/test_projection.py .......................x......... [ 23%] .....xxx.......x........................................................ [ 27%] .................. [ 28%] spectral_cube/tests/test_regrid.py ..........ssss....s.................s [ 30%] ss....sssssssssssss [ 31%] spectral_cube/tests/test_spectral_axis.py .............................. [ 33%] ...................... [ 34%] spectral_cube/tests/test_spectral_cube.py .............................. [ 36%] ........................................................................ [ 40%] ........................................................................ [ 45%] ........................................................................ [ 49%] ..............................s.....s...........sssss................... [ 53%] ..............................ssssss......................ss............ [ 57%] ........................................................................ [ 61%] ......................................ssssss......ssssssssssss......ssss [ 65%] ssssssss......ssssssssssss......ssssssssssss......ssssss................ [ 70%] ........................................................................ [ 74%] ..ssssss......ssssssssssss......ssssssssssss......ssssssssssss......ssss [ 78%] ssssssss......ssssss.................................s.s.F............xx [ 82%] xx....................................................................ss [ 86%] ss............................xxxxxxxx..............sss................. [ 91%] ....... [ 91%] spectral_cube/tests/test_stokes_spectral_cube.py ....................... [ 92%] ........................................................................ [ 97%] ..... [ 97%] spectral_cube/tests/test_subcubes.py ..ssssssssssssssssssss [ 98%] spectral_cube/tests/test_visualization.py ....ssssssss [ 99%] spectral_cube/tests/test_wcs_utils.py ............ [100%] =================================== FAILURES =================================== ________________________ test_oned_collapse_beams[True] ________________________ data_sdav_beams = PosixPath('/tmp/pytest-of-cjwatson/pytest-0/test_oned_collapse_beams_True_0/sdav_beams.fits') use_dask = True def test_oned_collapse_beams(data_sdav_beams, use_dask): # Check that an operation along the spatial dims returns an appropriate # spectrum cube, data = cube_and_raw(data_sdav_beams, use_dask=use_dask) cube._meta['BUNIT'] = 'K' cube._unit = u.K spec = cube.mean(axis=(1,2)) assert isinstance(spec, VaryingResolutionOneDSpectrum) # data has a redundant 1st axis > np.testing.assert_equal(spec.value, data.mean(axis=(1,2,3))) spectral_cube/tests/test_spectral_cube.py:1531: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (<built-in function eq>, array([0.49465334, 0.53732362, 0.37316832, 0.35550457]), array([0.49465334, 0.53732362, 0.37316832, 0.35550457])) kwds = {'err_msg': '', 'header': 'Arrays are not equal', 'strict': False, 'verbose': True} @wraps(func) def inner(*args, **kwds): with self._recreate_cm(): > return func(*args, **kwds) E AssertionError: E Arrays are not equal E E Mismatched elements: 1 / 4 (25%) E Max absolute difference: 1.11022302e-16 E Max relative difference: 2.06620925e-16 E x: array([0.494653, 0.537324, 0.373168, 0.355505]) E y: array([0.494653, 0.537324, 0.373168, 0.355505]) /usr/lib/python3.13/contextlib.py:85: AssertionError ----------------------------- Captured stderr call ----------------------------- WARNING: StokesWarning: Cube is a Stokes cube, returning spectral cube for I component [spectral_cube.io.core] ------------------------------ Captured log call ------------------------------- WARNING astropy:logger.py:244 StokesWarning: Cube is a Stokes cube, returning spectral cube for I component =========================== short test summary info ============================ FAILED spectral_cube/tests/test_spectral_cube.py::test_oned_collapse_beams[True] = 1 failed, 1487 passed, 212 skipped, 17 xfailed, 2 xpassed in 257.65s (0:04:17) = E: pybuild pybuild:389: test: plugin distutils failed with: exit code=1: cd /build/reproducible-path/spectral-cube-0.6.5/.pybuild/cpython3_3.13_spectral-cube/build; python3.13 -m pytest (3.12 behaves the same way; I've omitted it for brevity.) This looks like the first issue in https://github.com/radio-astro-tools/spectral-cube/issues/935. I tried cherry-picking a couple of patches from there, and that fixed it. Would you consider doing the same in unstable? I've attached a possible debdiff. Thanks, -- Colin Watson (he/him) [cjwat...@debian.org]
diff -Nru spectral-cube-0.6.5/debian/changelog spectral-cube-0.6.5/debian/changelog --- spectral-cube-0.6.5/debian/changelog 2024-12-17 07:12:11.000000000 +0000 +++ spectral-cube-0.6.5/debian/changelog 2025-01-07 14:19:23.000000000 +0000 @@ -1,3 +1,10 @@ +spectral-cube (0.6.5-6.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * mean -> nanmean in failing test (closes: #-1). + + -- Colin Watson <cjwat...@debian.org> Tue, 07 Jan 2025 14:19:23 +0000 + spectral-cube (0.6.5-6) unstable; urgency=medium * Remove six dependency (Closes: #1090171) diff -Nru spectral-cube-0.6.5/debian/patches/series spectral-cube-0.6.5/debian/patches/series --- spectral-cube-0.6.5/debian/patches/series 2024-12-17 07:11:57.000000000 +0000 +++ spectral-cube-0.6.5/debian/patches/series 2025-01-07 14:19:23.000000000 +0000 @@ -6,3 +6,4 @@ Don-t-run-LMV-test-on-big-endian-archs.patch Fix-test-for-Astropy-7.patch Remove-six-dependency.patch +test-nanmean.patch diff -Nru spectral-cube-0.6.5/debian/patches/test-nanmean.patch spectral-cube-0.6.5/debian/patches/test-nanmean.patch --- spectral-cube-0.6.5/debian/patches/test-nanmean.patch 1970-01-01 01:00:00.000000000 +0100 +++ spectral-cube-0.6.5/debian/patches/test-nanmean.patch 2025-01-07 14:19:23.000000000 +0000 @@ -0,0 +1,25 @@ +From: "Adam Ginsburg (keflavich)" <keflav...@gmail.com> +Date: Mon, 6 Jan 2025 11:13:06 -0500 +Subject: mean -> nanmean in failing test + +Origin: other, https://github.com/radio-astro-tools/spectral-cube/pull/929/commits/63d92273e7f423afd1f9080db93a95300a9a5064 +Origin: other, https://github.com/radio-astro-tools/spectral-cube/pull/929/commits/beb1233fb51cbbf8c3199a72512a37971f25b1d2 +Last-Update: 2025-01-07 +--- + spectral_cube/tests/test_spectral_cube.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/spectral_cube/tests/test_spectral_cube.py b/spectral_cube/tests/test_spectral_cube.py +index bbc1aaa..4ccd135 100644 +--- a/spectral_cube/tests/test_spectral_cube.py ++++ b/spectral_cube/tests/test_spectral_cube.py +@@ -1528,7 +1528,8 @@ def test_oned_collapse_beams(data_sdav_beams, use_dask): + spec = cube.mean(axis=(1,2)) + assert isinstance(spec, VaryingResolutionOneDSpectrum) + # data has a redundant 1st axis +- np.testing.assert_equal(spec.value, data.mean(axis=(1,2,3))) ++ # we changed to assert_almost_equal in 2025 because, for no known reason, epsilon-level differences crept in ++ np.testing.assert_almost_equal(spec.value, np.nanmean(data, axis=(1,2,3))) + assert cube.unit == spec.unit + assert spec.header['BUNIT'] == cube.header['BUNIT'] +