From 62bf1f278a38eed0b9c67dfe4945506856f2da9b Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Tue, 3 Jun 2025 15:57:20 +0200 Subject: [PATCH] pdlp: Fix test when using pytest 8.4.0 note: test_lp was considered as a test leading to the error ```sh (cd build && ctest -C Release -R "python_pdlp_") Test project .../build Start 175: python_pdlp_pdlp_test 1/2 Test #175: python_pdlp_pdlp_test .............***Failed 1.94 sec ============================= test session starts ============================== platform linux -- Python 3.13.2, pytest-8.4.0, pluggy-1.6.0 ... ../../../ortools/pdlp/python/pdlp_test.py .....F.... [100%] =================================== FAILURES =================================== ___________________________________ test_lp ____________________________________ Expected None, but test returned . Did you mean to use `assert` instead of `return`? =========================== short test summary info ============================ FAILED ../../../ortools/pdlp/python/pdlp_test.py::test_lp - Failed: Expected ... ========================= 1 failed, 9 passed in 1.40s ========================== ``` --- ortools/pdlp/python/pdlp_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ortools/pdlp/python/pdlp_test.py b/ortools/pdlp/python/pdlp_test.py index b812e41527..5464385a82 100644 --- a/ortools/pdlp/python/pdlp_test.py +++ b/ortools/pdlp/python/pdlp_test.py @@ -157,7 +157,7 @@ def tiny_lp(): return qp -def test_lp(): +def small_lp(): """Returns a small LP with all 4 patterns lower and upper bounds. min 5.5 x_0 - 2 x_1 - x_2 + x_3 - 14 s.t. @@ -221,7 +221,7 @@ class PrimalDualHybridGradientTest(absltest.TestCase): opt_criteria = params.termination_criteria.simple_optimality_criteria opt_criteria.eps_optimal_relative = 0.0 opt_criteria.eps_optimal_absolute = 1.0e-10 - result = pdlp.primal_dual_hybrid_gradient(test_lp(), params) + result = pdlp.primal_dual_hybrid_gradient(small_lp(), params) self.assertEqual( result.solve_log.termination_reason, solve_log_pb2.TERMINATION_REASON_OPTIMAL,