From 1a322bd08513c55bc37560d8430ad7a3b4a92e21 Mon Sep 17 00:00:00 2001 From: pchtsp Date: Mon, 29 Jan 2024 09:13:18 +0100 Subject: [PATCH] fixed gurobi wrapper being used with other solvers --- pulp/tests/test_pulp.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pulp/tests/test_pulp.py b/pulp/tests/test_pulp.py index d36fcae5..d74d66ed 100644 --- a/pulp/tests/test_pulp.py +++ b/pulp/tests/test_pulp.py @@ -45,11 +45,14 @@ def gurobi_test(test_item): @functools.wraps(test_item) - def skip_wrapper(*args, **kwargs): + def skip_wrapper(test_obj, *args, **kwargs): + if not test_obj.solver.name in ["GUROBI", "GUROBI_CMD"]: + # if we're not testing gurobi, we do not care on the licence + return test_item(test_obj, *args, **kwargs) if gp is None: raise unittest.SkipTest("No gurobipy, can't check license") try: - test_item(*args, **kwargs) + return test_item(*args, **kwargs) except gp.GurobiError as ge: # Skip the test if the failure was due to licensing if ge.errno == gp.GRB.Error.SIZE_LIMIT_EXCEEDED: