From 094f1159095f147aa8ea2f3b3458594a8acea02d Mon Sep 17 00:00:00 2001 From: Siddhartha Dhiman Date: Thu, 12 Sep 2024 10:20:20 -0400 Subject: [PATCH] Fix failing tests --- .gitignore | 2 +- tests/test_fitting_dwipy.py | 1 - tests/test_preprocessing_mrpreproc.py | 8 ++++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 5963969..c1d803d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Folders to ignore -.coverage +.coverage* .idea/ __pycache__/ .ipynb_checkpoints/ diff --git a/tests/test_fitting_dwipy.py b/tests/test_fitting_dwipy.py index 5a69f88..b57c89f 100644 --- a/tests/test_fitting_dwipy.py +++ b/tests/test_fitting_dwipy.py @@ -264,7 +264,6 @@ def test_dwi_constraints_success(constraints): shape = (60, 22) elif sum(constraints) == 3: shape = (90, 22) - print(np.shape(val)) assert val.dtype == np.float64 assert np.shape(val) == shape diff --git a/tests/test_preprocessing_mrpreproc.py b/tests/test_preprocessing_mrpreproc.py index 784bc8c..b2ae83e 100644 --- a/tests/test_preprocessing_mrpreproc.py +++ b/tests/test_preprocessing_mrpreproc.py @@ -6,7 +6,7 @@ from conftest import load_data from pydesigner.preprocessing import mrpreproc, mrinfoutil -from pydesigner.system.errors import MRTrixError +from pydesigner.system.errors import FileExtensionError, MRTrixError DATA = load_data(type="hifi") PATH_DWI = DATA["nifti"] @@ -198,13 +198,13 @@ def test_denoise_output_success(tmp_path, nthreads, force, verbose): def test_degibbs_output_failure(tmp_path): """Test whether function `degibbs` fails when return code is non-zero""" - output_nii = str(tmp_path / "output.nii") + output_mif = str(tmp_path / "output.mif") with patch("subprocess.run") as mock_subprocess: mock_subprocess.return_value = MagicMock( returncode=1, stderr="stderr" ) with pytest.raises(MRTrixError) as exc: - mrpreproc.degibbs(PATH_DWI, output_nii) + mrpreproc.degibbs(PATH_MIF, output_mif) assert f"Mrdegibbs failed" in str(exc.value) assert "stderr" in str(exc.value) @@ -222,7 +222,7 @@ def test_degibbs_output_failure(tmp_path): def test_degibbs_output_success(tmp_path, nthreads, force, verbose): """Test whether function `degibbs` fails when return code is non-zero""" output_mif = str(tmp_path / "output.mif") - mrpreproc.degibbs(PATH_DWI, output_mif, nthreads=nthreads, force=force, verbose=verbose) + mrpreproc.degibbs(PATH_MIF, output_mif, nthreads=nthreads, force=force, verbose=verbose) assert os.path.exists(output_mif) assert mrinfoutil.format(output_mif) == "MRtrix" mrinfoutil.size(output_mif) == (2, 2, 2, 337)