Skip to content

Commit

Permalink
fixed gurobi wrapper being used with other solvers
Browse files Browse the repository at this point in the history
  • Loading branch information
pchtsp committed Jan 29, 2024
1 parent cfde9c6 commit 1a322bd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pulp/tests/test_pulp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 1a322bd

Please sign in to comment.