Skip to content

Commit

Permalink
change skip logic
Browse files Browse the repository at this point in the history
  • Loading branch information
tlambert03 committed Dec 19, 2024
1 parent ff34a4e commit a5f5737
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions tests/test_solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,12 @@
# (this is the best way I could find to determine this so far)
gu_marks = []
try:
import gurobipy as gb

ilpy.Solver(0, ilpy.VariableType.Binary, None, ilpy.Preference.Gurobi)
HAVE_GUROBI = True
try:
import gurobipy as gb
except ImportError:
if os.getenv("CI"):
raise ImportError("Gurobipy not installed, but required for CI") from None
gb = None
except RuntimeError:
gu_marks.append(pytest.mark.xfail(reason="Gurobi missing or no license found"))
except Exception as e:
gu_marks.append(pytest.mark.xfail(reason=f"Gurobi error: {e}"))
gb = None
HAVE_GUROBI = False

Expand Down

0 comments on commit a5f5737

Please sign in to comment.