From a5f5737aea149434bd1c1a660c749af19e696f2c Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Wed, 18 Dec 2024 20:23:38 -0500 Subject: [PATCH] change skip logic --- tests/test_solvers.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/test_solvers.py b/tests/test_solvers.py index 8ebc962..efb45e7 100644 --- a/tests/test_solvers.py +++ b/tests/test_solvers.py @@ -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