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 <ortools.pdlp.python.pdlp.QuadraticProgram object at 0x7fd4b600b170>. 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 ==========================
```
This commit is contained in:
Corentin Le Molgat
2025-06-03 15:57:20 +02:00
parent 888479c8f1
commit 62bf1f278a

View File

@@ -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,