From 6dbd7671ceef1180d033b56b1bf65a30eb5da393 Mon Sep 17 00:00:00 2001 From: Ebrahim Ebrahim Date: Tue, 13 Aug 2024 15:46:37 -0400 Subject: [PATCH] Fix unit test that uses ITK image Had to filter out this batch of weird swig warnings because in our pyproject.toml we configure pytest such that warnings are treated as errors and this somehow causes a segfault from itk when any image related functionality is touched. It only happened on python3.12, not 3.9. The warnings are things like ``` builtin type SwigPyObject has no __module__ attribute ``` --- tests/test_resource.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_resource.py b/tests/test_resource.py index c1d5b47..fb058bb 100644 --- a/tests/test_resource.py +++ b/tests/test_resource.py @@ -16,17 +16,17 @@ def test_bval_abstractness(): with pytest.raises(TypeError): - BvalResource() # type: ignore[abstract] + BvalResource() def test_bvec_abstractness(): with pytest.raises(TypeError): - BvecResource() # type: ignore[abstract] + BvecResource() def test_volume_abstractness(): with pytest.raises(TypeError): - VolumeResource() # type: ignore[abstract] + VolumeResource() @pytest.fixture() @@ -64,6 +64,7 @@ def test_bvec_inmemory_get(bvec_array): assert (bvec.get() == bvec_array).all() +@pytest.mark.filterwarnings("ignore:builtin type [sS]wig.* has no __module__ attribute") def test_volume_inmemory_get_array(volume_array): vol = InMemoryVolumeResource(image=itk.image_from_array(volume_array)) assert (vol.get_array() == volume_array).all()