Skip to content

Commit ba924e8

Browse files
authored
Merge pull request #137 from OSIPI/wrapper_dev_testing
Update xfail logic and test skipping for TCML_TechnionIIT_lsqBOBYQA
2 parents cd5b488 + b4e9fc3 commit ba924e8

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,8 @@ def bound_input(datafile, algorithms):
282282
for algorithm in algorithms["algorithms"]:
283283
algorithm_dict = algorithms.get(algorithm, {})
284284
if not algorithm_dict.get('deep_learning',False):
285-
xfail = {"xfail": name in algorithm_dict.get("xfail_names", {}),
286-
"strict": algorithm_dict.get("xfail_names", {}).get(name, True)}
285+
xfail = {"xfail": name in algorithm_dict.get("xfail_names", {}) or "bounds" in algorithm_dict.get("xfail_names", {}),
286+
"strict": algorithm_dict.get("xfail_names", {}).get("bounds", algorithm_dict.get("xfail_names", {}).get(name,True))}
287287
kwargs = algorithm_dict.get("options", {})
288288
tolerances = algorithm_dict.get("tolerances", {})
289289
requires_matlab = algorithm_dict.get("requires_matlab", False)

tests/IVIMmodels/unit_tests/algorithms.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"TF_reference_IVIMfit"
2929
],
3030
"TCML_TechnionIIT_lsqBOBYQA": {
31-
"xfail_names": {"pericardium": false}
31+
"xfail_names": {"pericardium": false, "bounds": false}
3232
},
3333
"IVIM_NEToptim": {
3434
"deep_learning": true,
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# For TCML_TechnionIIT_lsqBOBYQA we skip 2 tests:
2+
The pericardium seems to give weird results on some systems. We believe this to be different interpertation of the data and not a systematic error in the algorithm
3+
For the bounds test, on Mac and Ubuntu, TCML_TechnionIIT_lsqBOBYQA returns default values of 0. We do not believe this to be an intrensic error of the code, but an instable performance in small, unrealistic boundaries.
4+
**Consequently, bounds are not tested for TCML_TechnionIIT_lsqBOBYQA and it should be used with caution when bounds are requiered.**

tests/IVIMmodels/unit_tests/test_ivim_fit.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,11 @@ def test_default_bounds_and_initial_guesses(algorithmlist,eng):
112112
assert 0.9 <= fit.osipi_initial_guess["S0"] <= 1.1, f"For {algorithm}, the default initial guess for S0 {fit.osipi_initial_guess['S0']} is unrealistic; note signal is normalized"
113113

114114

115-
def test_bounds(bound_input, eng):
115+
def test_bounds(bound_input, eng, request):
116116
name, bvals, data, algorithm, xfail, kwargs, tolerances, requires_matlab = bound_input
117+
if xfail["xfail"]:
118+
mark = pytest.mark.xfail(reason="xfail", strict=xfail["strict"])
119+
request.node.add_marker(mark)
117120
if requires_matlab:
118121
if eng is None:
119122
pytest.skip(reason="Running without matlab; if Matlab is available please run pytest --withmatlab")

0 commit comments

Comments
 (0)