Skip to content

Commit 648a7a6

Browse files
fix bug for linux and mac
1 parent d471105 commit 648a7a6

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

.github/workflows/unit_test.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,23 @@ jobs:
3232
pip install -r requirements.txt
3333
- name: Check out repository
3434
uses: actions/checkout@v4
35+
- name: Set environment variables for MATLAB Engine
36+
run: |
37+
if [[ "${{ runner.os }}" == "macOS" ]]; then
38+
echo "DYLD_LIBRARY_PATH=/Applications/MATLAB_R2025a.app/bin/maci64:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
39+
elif [[ "${{ runner.os }}" == "Linux" ]]; then
40+
echo "LD_LIBRARY_PATH=/usr/local/MATLAB/R2025a/bin/glnxa64:$LD_LIBRARY_PATH" >> $GITHUB_ENV
41+
elif [[ "${{ runner.os }}" == "Windows" ]]; then
42+
echo "C:\Program Files\MATLAB\R2025a\bin\win64" >> $GITHUB_PATH
43+
fi
3544
- name: Set up MATLAB
3645
uses: matlab-actions/setup-matlab@v2
3746
with:
3847
release: R2025a
3948
- name: Install MATLAB Engine for Python
4049
run: |
4150
python -m pip install matlabengine==25.1.2
51+
4252
- name: Test with pytest
4353
run: |
4454
pip install pytest pytest-cov

tests/IVIMmodels/unit_tests/test_ivim_fit.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,15 @@ def algorithms():
108108
algorithm_information = json.load(f)
109109
algorithms = algorithm_information["algorithms"]
110110
for algorithm in algorithms:
111-
yield algorithm
112-
113-
@pytest.mark.parametrize("algorithm", algorithms())
114-
def test_default_bounds_and_initial_guesses(algorithm):
115-
fit = OsipiBase(algorithm=algorithm)
111+
algorithm_dict = algorithm_information.get(algorithm, {})
112+
args={}
113+
if algorithm_dict.get("requieres_matlab", {}) == True:
114+
args['eng'] = eng
115+
yield algorithm, args
116+
117+
@pytest.mark.parametrize("algorithm, args", algorithms())
118+
def test_default_bounds_and_initial_guesses(algorithm, args):
119+
fit = OsipiBase(algorithm=algorithm,**args)
116120
#assert fit.bounds is not None, f"For {algorithm}, there is no default fit boundary"
117121
#assert fit.initial_guess is not None, f"For {algorithm}, there is no default fit initial guess"
118122
if fit.use_bounds:
@@ -154,6 +158,8 @@ def bound_input():
154158
"strict": algorithm_dict.get("xfail_names", {}).get(name, True)}
155159
kwargs = algorithm_dict.get("options", {})
156160
tolerances = algorithm_dict.get("tolerances", {})
161+
if algorithm_dict.get("requieres_matlab", {}) == True:
162+
kwargs={**kwargs,'eng': eng}
157163
yield name, bvals, data, algorithm, xfail, kwargs, tolerances
158164

159165

0 commit comments

Comments
 (0)