Skip to content

Commit 86f5f05

Browse files
authored
Merge pull request #3598 from michaelbynum/solver_tests
Test List of Solvers
2 parents 5df0a00 + 60e31ad commit 86f5f05

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pyomo/contrib/solver/tests/solvers/test_solvers.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
NoReducedCostsError,
2929
)
3030
from pyomo.contrib.solver.common.base import SolverBase
31+
from pyomo.contrib.solver.common.factory import SolverFactory
3132
from pyomo.contrib.solver.solvers.ipopt import Ipopt
3233
from pyomo.contrib.solver.solvers.gurobi_persistent import GurobiPersistent
3334
from pyomo.contrib.solver.solvers.gurobi_direct import GurobiDirect
@@ -45,7 +46,7 @@
4546
raise unittest.SkipTest('Parameterized is not available.')
4647

4748
all_solvers = [
48-
('gurobi', GurobiPersistent),
49+
('gurobi_persistent', GurobiPersistent),
4950
('gurobi_direct', GurobiDirect),
5051
('ipopt', Ipopt),
5152
('highs', Highs),
@@ -76,6 +77,15 @@ def _load_tests(solver_list):
7677
return res
7778

7879

80+
def test_all_solvers_list():
81+
"""
82+
Make sure that new solver interfaces get
83+
added to the lists of solvers at the top of the file
84+
"""
85+
for name, cls in SolverFactory._cls.items():
86+
assert (name, cls) in all_solvers
87+
88+
7989
class TestDualSignConvention(unittest.TestCase):
8090
@parameterized.expand(input=_load_tests(all_solvers))
8191
def test_equality(self, name: str, opt_class: Type[SolverBase], use_presolve: bool):

0 commit comments

Comments
 (0)