@@ -94,8 +94,8 @@ def test_simple_opt(model_interface):
9494 assert y_val == approx (8.0 )
9595
9696
97- def test_constant_objective (model_interface ):
98- model = model_interface
97+ def test_constant_objective (model_interface_oneshot ):
98+ model = model_interface_oneshot
9999
100100 x = model .add_variable (lb = 0.0 , ub = 1.0 )
101101 obj = 1.0
@@ -106,13 +106,16 @@ def test_constant_objective(model_interface):
106106 model .set_objective (obj , poi .ObjectiveSense .Maximize )
107107 model .optimize ()
108108 status = model .get_model_attribute (poi .ModelAttribute .TerminationStatus )
109- assert status == poi .TerminationStatusCode .OPTIMAL
109+ assert (
110+ status == poi .TerminationStatusCode .OPTIMAL
111+ or status == poi .TerminationStatusCode .LOCALLY_SOLVED
112+ )
110113 obj_val = model .get_model_attribute (poi .ModelAttribute .ObjectiveValue )
111114 assert obj_val == approx (1.0 )
112115
113116
114- def test_constraint_primal_dual (model_interface ):
115- model = model_interface
117+ def test_constraint_primal_dual (model_interface_oneshot ):
118+ model = model_interface_oneshot
116119
117120 x = model .add_variable (lb = 0.0 , ub = 1.0 )
118121 y = model .add_variable (lb = 0.0 , ub = 1.0 )
@@ -128,7 +131,10 @@ def test_constraint_primal_dual(model_interface):
128131
129132 model .optimize ()
130133 status = model .get_model_attribute (poi .ModelAttribute .TerminationStatus )
131- assert status == poi .TerminationStatusCode .OPTIMAL
134+ assert (
135+ status == poi .TerminationStatusCode .OPTIMAL
136+ or status == poi .TerminationStatusCode .LOCALLY_SOLVED
137+ )
132138
133139 primal_val = model .get_constraint_attribute (con1 , poi .ConstraintAttribute .Primal )
134140 assert primal_val == approx (1.0 )
@@ -137,8 +143,8 @@ def test_constraint_primal_dual(model_interface):
137143 assert dual_val == approx (0.5 )
138144
139145
140- def test_add_quadratic_expr_as_linear_throws_error (model_interface ):
141- model = model_interface
146+ def test_add_quadratic_expr_as_linear_throws_error (model_interface_oneshot ):
147+ model = model_interface_oneshot
142148
143149 xs = model .add_m_variables (10 )
144150 x2_sum = poi .quicksum (x * x for x in xs .flat )
@@ -147,8 +153,8 @@ def test_add_quadratic_expr_as_linear_throws_error(model_interface):
147153 model .add_linear_constraint (x2_sum <= 1.0 )
148154
149155
150- def test_exprbuilder_self_operation (model_interface ):
151- model = model_interface
156+ def test_exprbuilder_self_operation (model_interface_oneshot ):
157+ model = model_interface_oneshot
152158
153159 x = model .add_m_variables (2 , lb = 1.0 , ub = 4.0 )
154160
0 commit comments