Skip to content

Commit 52d7deb

Browse files
exclude matlab algorithms from testing algorithm list if matlab is not isntalled
1 parent 4e4a6dc commit 52d7deb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

conftest.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def pytest_addoption(parser):
8181
help="Drop this algorithm from the list"
8282
)
8383
parser.addoption(
84-
"--with-matlab",
84+
"--withmatlab",
8585
action="store_true",
8686
default=False,
8787
help="Run MATLAB-dependent tests"
@@ -91,7 +91,7 @@ def pytest_addoption(parser):
9191

9292
def pytest_configure(config):
9393
global eng
94-
if config.getoption("--with-matlab"):
94+
if config.getoption("--withmatlab"):
9595
import matlab.engine
9696
print("Starting MATLAB engine...")
9797
eng = matlab.engine.start_matlab()
@@ -178,6 +178,11 @@ def algorithm_list(filename, selected, dropped):
178178
with algorithm_path.open() as f:
179179
algorithm_information = json.load(f)
180180
algorithms = set(algorithm_information["algorithms"])
181+
for algorithm in algorithms:
182+
algorithm_dict = algorithm_information.get(algorithm, {})
183+
if algorithm_dict.get("requieres_matlab", {}) == True:
184+
if eng is None:
185+
algorithms = algorithms - set(algorithm)
181186
algorithms = algorithms - set(dropped)
182187
if len(selected) > 0 and selected[0]:
183188
algorithms = algorithms & set(selected)

0 commit comments

Comments
 (0)