@@ -373,7 +373,9 @@ def test_knitro_solver_no_log(tmp_path: Path) -> None:
373373@pytest .mark .skipif (
374374 "gurobi" not in set (solvers .licensed_solvers ), reason = "Gurobi is not installed"
375375)
376- def test_gurobi_environment_with_dict (model : Model , tmp_path : Path ) -> None : # noqa: F811
376+ def test_gurobi_environment_with_dict (
377+ model : Model , tmp_path : Path
378+ ) -> None : # noqa: F811
377379 gurobi = solvers .Gurobi ()
378380
379381 mps_file = tmp_path / "problem.mps"
@@ -399,7 +401,9 @@ def test_gurobi_environment_with_dict(model: Model, tmp_path: Path) -> None: #
399401@pytest .mark .skipif (
400402 "gurobi" not in set (solvers .licensed_solvers ), reason = "Gurobi is not installed"
401403)
402- def test_gurobi_environment_with_gurobi_env (model : Model , tmp_path : Path ) -> None : # noqa: F811
404+ def test_gurobi_environment_with_gurobi_env (
405+ model : Model , tmp_path : Path
406+ ) -> None : # noqa: F811
403407 import gurobipy as gp
404408
405409 gurobi = solvers .Gurobi ()
@@ -678,18 +682,18 @@ def test_mosek_choose_solution_falls_back_to_itr_when_both_non_optimal() -> None
678682@pytest .mark .skipif (
679683 "mosek" not in set (solvers .licensed_solvers ), reason = "Mosek is not installed"
680684)
681- def test_mosek_smoke_lp (tmp_path : Path ) -> None :
685+ def test_mosek_smoke_lp () -> None :
682686 """End-to-end smoke test: a small bounded LP solves to a finite optimum."""
683- mosek_solver = solvers . Mosek ()
684- lp_file = tmp_path / "problem.lp"
685- lp_file . write_text ( free_lp_problem )
686- sol_file = tmp_path / "solution.sol"
687+ m = Model ()
688+ x = m . add_variables ( name = "x" , lower = 0 )
689+ m . add_constraints ( 2 * x >= 10 , name = "c1" )
690+ m . add_objective ( x )
687691
688- result = mosek_solver . solve_problem ( problem_fn = lp_file , solution_fn = sol_file )
692+ result = solvers . Solver . from_name ( "mosek" , m ). solve ( )
689693
690694 assert result .status .is_ok
691695 assert result .solution is not None
692696 import math
693697
694698 assert math .isfinite (result .solution .objective )
695- assert result .solution .objective == pytest .approx (80.0 / 3 .0 , abs = 1e-3 )
699+ assert result .solution .objective == pytest .approx (5 .0 , abs = 1e-3 )
0 commit comments