python-nibabel fails to build with pytest 8. =================================== FAILURES =================================== _____________________ TestLoadSave.test_load_complex_file ______________________ self = <nibabel.streamlines.tests.test_streamlines.TestLoadSave testMethod=test_load_complex_file> def test_load_complex_file(self): for lazy_load in [False, True]: > for complex_filename in DATA['complex_filenames']: E KeyError: 'complex_filenames' nibabel/streamlines/tests/test_streamlines.py:170: KeyError ______________________ TestLoadSave.test_load_empty_file _______________________ self = <nibabel.streamlines.tests.test_streamlines.TestLoadSave testMethod=test_load_empty_file> def test_load_empty_file(self): for lazy_load in [False, True]: > for empty_filename in DATA['empty_filenames']: E KeyError: 'empty_filenames' nibabel/streamlines/tests/test_streamlines.py:142: KeyError ______________________ TestLoadSave.test_load_simple_file ______________________ self = <nibabel.streamlines.tests.test_streamlines.TestLoadSave testMethod=test_load_simple_file> def test_load_simple_file(self): for lazy_load in [False, True]: > for simple_filename in DATA['simple_filenames']: E KeyError: 'simple_filenames' nibabel/streamlines/tests/test_streamlines.py:156: KeyError _____________________ TestLoadSave.test_save_complex_file ______________________ self = <nibabel.streamlines.tests.test_streamlines.TestLoadSave testMethod=test_save_complex_file> def test_save_complex_file(self): complex_tractogram = Tractogram( > DATA['streamlines'], DATA['data_per_streamline'], DATA['data_per_point'], affine_to_rasmm=np.eye(4), ) E KeyError: 'streamlines' nibabel/streamlines/tests/test_streamlines.py:230: KeyError ____________________ TestLoadSave.test_save_from_generator _____________________ self = <nibabel.streamlines.tests.test_streamlines.TestLoadSave testMethod=test_save_from_generator> def test_save_from_generator(self): > tractogram = Tractogram(DATA['streamlines'], affine_to_rasmm=np.eye(4)) E KeyError: 'streamlines' nibabel/streamlines/tests/test_streamlines.py:285: KeyError ______________________ TestLoadSave.test_save_simple_file ______________________ self = <nibabel.streamlines.tests.test_streamlines.TestLoadSave testMethod=test_save_simple_file> def test_save_simple_file(self): > tractogram = Tractogram(DATA['streamlines'], affine_to_rasmm=np.eye(4)) E KeyError: 'streamlines' nibabel/streamlines/tests/test_streamlines.py:220: KeyError ___________________ TestLoadSave.test_save_sliced_tractogram ___________________ self = <nibabel.streamlines.tests.test_streamlines.TestLoadSave testMethod=test_save_sliced_tractogram> def test_save_sliced_tractogram(self): > tractogram = Tractogram(DATA['streamlines'], affine_to_rasmm=np.eye(4)) E KeyError: 'streamlines' nibabel/streamlines/tests/test_streamlines.py:265: KeyError ____________________ TestLoadSave.test_save_tractogram_file ____________________ self = <nibabel.streamlines.tests.test_streamlines.TestLoadSave testMethod=test_save_tractogram_file> def test_save_tractogram_file(self): > tractogram = Tractogram(DATA['streamlines'], affine_to_rasmm=np.eye(4)) E KeyError: 'streamlines' nibabel/streamlines/tests/test_streamlines.py:192: KeyError ____________________________ test_cmp_pkg_version_0 ____________________________ def test_cmp_pkg_version_0(): # Test version comparator > assert cmp_pkg_version(nib.__version__) == 0 E AssertionError: assert 1 == 0 E + where 1 = cmp_pkg_version('5.2.1') E + where '5.2.1' = nib.__version__ nibabel/tests/test_pkg_info.py:28: AssertionError ____________________________ test_unremoved_module _____________________________ @mock.patch(_sched('MODULE'), [('3.0.0', ['nibabel.nifti1'])]) def test_unremoved_module(): > with pytest.raises(AssertionError): E Failed: DID NOT RAISE <class 'AssertionError'> nibabel/tests/test_removalschedule.py:163: Failed ____________________________ test_unremoved_object _____________________________ @mock.patch(_sched('OBJECT'), [('3.0.0', [('nibabel.nifti1', 'Nifti1Image')])]) def test_unremoved_object(): > with pytest.raises(AssertionError): E Failed: DID NOT RAISE <class 'AssertionError'> nibabel/tests/test_removalschedule.py:169: Failed _____________________________ test_unremoved_attr ______________________________ @mock.patch(_sched('ATTRIBUTE'), [('3.0.0', [('nibabel.nifti1', 'Nifti1Image', 'affine')])]) def test_unremoved_attr(): > with pytest.raises(AssertionError): E Failed: DID NOT RAISE <class 'AssertionError'> nibabel/tests/test_removalschedule.py:175: Failed =========================== short test summary info ============================ FAILED nibabel/streamlines/tests/test_streamlines.py::TestLoadSave::test_load_complex_file FAILED nibabel/streamlines/tests/test_streamlines.py::TestLoadSave::test_load_empty_file FAILED nibabel/streamlines/tests/test_streamlines.py::TestLoadSave::test_load_simple_file FAILED nibabel/streamlines/tests/test_streamlines.py::TestLoadSave::test_save_complex_file FAILED nibabel/streamlines/tests/test_streamlines.py::TestLoadSave::test_save_from_generator FAILED nibabel/streamlines/tests/test_streamlines.py::TestLoadSave::test_save_simple_file FAILED nibabel/streamlines/tests/test_streamlines.py::TestLoadSave::test_save_sliced_tractogram FAILED nibabel/streamlines/tests/test_streamlines.py::TestLoadSave::test_save_tractogram_file FAILED nibabel/tests/test_pkg_info.py::test_cmp_pkg_version_0 - AssertionErro... FAILED nibabel/tests/test_removalschedule.py::test_unremoved_module - Failed:... FAILED nibabel/tests/test_removalschedule.py::test_unremoved_object - Failed:... FAILED nibabel/tests/test_removalschedule.py::test_unremoved_attr - Failed: D... = 12 failed, 5397 passed, 52 skipped, 15 xfailed, 33 xpassed, 3527 warnings in 134.11s (0:02:14) = https://docs.pytest.org/en/stable/changelog.html For the build logs, see: https://copr-be.cloud.fedoraproject.org/results/thrnciar/pytest/fedora-rawhide-x86_64/07248431-python-nibabel/ For all our attempts to build python-nibabel with pytest 8, see: https://copr.fedorainfracloud.org/coprs/thrnciar/pytest/package/python-nibabel/ Let us know here if you have any questions. Pytest 8 is planned to be included in Fedora 41. And this bugzilla is a heads up before we merge new pytest into rawhide. For more info see a Fedora Change proposal https://fedoraproject.org/wiki/Changes/Pytest_8 We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.
I wanted to report this problem upstream, but I can see their CI is passing with pytest 8.0.2 [0]. In my COPR it never worked with pytest>8 so there might be some fix in the master branch. Could you please try to build it from it? I have no experience with %forgesource macros and I wasn't able to modify spec file to make it work. Thank you. [0] https://github.com/nipy/nibabel/actions/runs/9247532961/job/25436516987
I'll take a look. Building from master should be as simple as replacing `%global tag %{version}` with `%global branch master`.
I'm seeing the same failures building from master. However, there is: https://github.com/nipy/nibabel/commit/e4facc17fbebeb92fa6fed600b9a349c6e373ee3 which points to: https://github.com/scientific-python/pytest-doctestplus/issues/239 and Copr is currently using pytest 8.2.1. It seems unrelated, though, since we do not run doctests. But maybe this is a regression in 8.2 that upstream hasn't come across yet due to the version being pinned to `<8.1`? I'll dig a bit further. But it might be worth reporting upstream, nonetheless.
This appears to be a regression in pytest. Testing with pytest 8.0.2 all tests pass. With the next release, 8.1.1, the failures appear. I skimmed through the pytest changelog, but didn't notice anything that might explain the failures.
I dug a little deeper and was able to fix one failing test suite. The others remained a mystery. They appear to succeed when run inside the mock chroot without changing anything. I'm puzzled. But those tests are also less interesting to downstream. They are their to remind upstream in case they missed something in their workflow. I sent the fix upstream and excluded the other failing tests. I'll talk to upstream letting them know.
Thank you for the investigation!
I am setting this to POST, for tracking purposes.
It seems Debian stumbled onto this issue as well and used a different approach to fixing the tests: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1071461 There's some discussion going on now in the upstream PR, but upstream developers have yet to join in.
Since this seems to be related to `setup()` and `teardown()` nose compatibility functions, I'm just reminded of my change proposal, which I'm still considering for submission: https://fedoraproject.org/wiki/Changes/ReplaceNoseWithPynose
All tests are fixed now. The old nose compatibility functions needed replacement, though they were hiding in different places.